// pages/components/voucher-select/index.js Component({ /** * 组件的属性列表 */ properties: { columns:{ type:Array }, placeholder:{ type:String }, selectValue:{ type:String }, selectIndex:{ type:String }, background:{ type:String }, value:{ type:String, value:"" } }, /**数据监听 */ observers: { columns: function (val) { if(val.length > 0) { this.setData({ item:val[0], value:val[0].text }) } else { this.setData({ item:[], value:'' }) } }, selectValue:function(val){ let columns = this.data.columns; if(val && columns){ for(let i=0;i