const app = getApp(); Component({ properties: { show: { type: Boolean, value: false }, currentValue:{ type: String, value: "" }, stepIndex:{ type: Number, value: "" } }, observers: { "currentValue": function(cur){ } }, id: "", data: { currentValue: "", selectIndex: 0 }, position: {}, ready() {}, methods: { onInput(e) { const { value } = e.detail; this.setData({ currentValue: value }); }, confirm(e) { if (!this.data.currentValue) { wx.showToast({ icon: "none", title: "请输入文字" }); return; } this.triggerEvent("add", { currentValue: this.data.currentValue, Url: app.globalData.voice }); }, selectSey(e){ console.log(e.currentTarget.dataset.index) this.setData({ selectIndex: e.currentTarget.dataset.index - 0 }); } } });