Component({ /** * 组件的属性列表 */ properties: { listData: { type: Array, value: [], }, isShowPicker:{ type: Boolean, value: false, }, defaultPickData:{ type:Array, value:[] }, key:{ type:String, value:'' } }, /** * 组件的初始数据 */ data: { imageServerUrl: getApp().globalData.imageServerUrl, idx: 0, }, /** * 组件的方法列表 */ lifetimes: { ready :function(){ setTimeout(() => { var idx =this.data.defaultPickData[0] this.setData({ idx }) },200) }, }, methods: { btn_fn(){ }, cancel(e){ console.log(e) this.triggerEvent('cancel',false) }, bindChange(e){ console.log(this.data.defaultPickData[0]) console.log(e) this.setData({ idx:e.detail.value[0] }) }, confirm(e){ this.setData({ isShowPicker:false }) this.triggerEvent('confirm',this.data.idx) } } })