Component({ /** * 组件的属性列表 */ properties: { roomType:{ type: String, value:"会议室类型" }, selectBox:{ type: Array, value:[] } }, /** * 组件的初始数据 */ data: { levelInd:0, showItems:false, array:[], roomType:'', }, /** * 组件的方法列表 */ methods: { bindLevelChange(e){ let index = e.currentTarget.dataset.ind let showItems = true let array = this.data.selectBox[index].array this.setData({ showItems: showItems, array, levelInd:index, roomType:'' }) }, selectItem(e){ // console.log(e.currentTarget.dataset.type) let val = e.currentTarget.dataset.type this.data.selectBox[this.data.levelInd].roomType = val let selectBox = this.data.selectBox let data = { type: this.data.levelInd, val: val } this.triggerEvent("bindValue",data) this.setData({ roomType: val, showItems: false, selectBox }) }, tapPages(){ this.setData({ showItems: false, }) }, showPicker(){ this.setData({ showItems: true, }) } } })