129 lines
2.1 KiB
JavaScript
129 lines
2.1 KiB
JavaScript
// components/brandSelect/index.js
|
|
Component({
|
|
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
show: {
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
duration: {
|
|
type: Number,
|
|
value: 500
|
|
},
|
|
position: {
|
|
type: String,
|
|
value: 'right'
|
|
},
|
|
round: {
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
overlay: {
|
|
type: Boolean,
|
|
value: true
|
|
},
|
|
customStyle: {
|
|
type: String,
|
|
value: ''
|
|
},
|
|
overlayStyle: {
|
|
type: String,
|
|
value: 'background-color: rgba(0, 0, 0, 0.7)'
|
|
},
|
|
},
|
|
observers: {
|
|
'show': function (value) {
|
|
// 在 numberA 或者 numberB 被设置时,执行这个函数
|
|
this.setData({
|
|
show_page: value,
|
|
cur: -1
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
show_page: false,
|
|
// list: [],
|
|
list: [{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
},{
|
|
name: '宝马'
|
|
}],
|
|
cur: -1
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
onBeforeEnter(res) {
|
|
// console.log(res)
|
|
},
|
|
onEnter(res) {
|
|
// console.log(res)
|
|
this.triggerEvent('enter')
|
|
},
|
|
onAfterEnter(res) {
|
|
// console.log(res)
|
|
},
|
|
onBeforeLeave(res) {
|
|
// console.log(res)
|
|
},
|
|
onLeave(res) {
|
|
// console.log(res)
|
|
this.triggerEvent('leave', {index: this.data.cur})
|
|
},
|
|
onAfterLeave(res) {
|
|
// console.log(res)
|
|
},
|
|
|
|
onClickOverlay(res) {
|
|
// console.log(res)
|
|
},
|
|
exit() {
|
|
this.setData({ show_page: false })
|
|
},
|
|
bindSelectIndex(e){
|
|
console.log(e)
|
|
this.setData({
|
|
cur: e.currentTarget.dataset.index
|
|
})
|
|
}
|
|
}
|
|
}) |