// components/popup/index.js const app = getApp() Component({ /** * 组件的属性列表 */ properties: { }, ready() { var that = this; // 动态获取屏幕高度 wx.getSystemInfo({ success: (result) => { that.setData({ height: result.windowHeight }); }, }) }, properties: { visible: { type: Boolean }, }, /** * 组件的初始数据 */ data: { inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding: 0 0 0 16rpx;', visible: false, //打开弹窗的对应下标 height: '', //屏幕高度 inputvalue: '', joinGroup: '', noTip: false, }, /** * 组件的方法列表 */ methods: { //关闭弹窗 closePopup() { this.setData({ visible: false, inputvalue: '', }) }, // 输入框改变 inputChange(e) { this.setData({ inputvalue: e.detail.value }) }, // 单选框改变 onChangeRadio(e) { console.log(e) this.setData({ joinGroup: e.currentTarget.dataset.value }) }, // 确定 confirmSuggest() { if (this.data.joinGroup) { if (this.data.joinGroup == 1) { if (!this.data.inputvalue.length) { wx.showToast({ icon: "error", title: '请填写联系方式', }) } else { // this.joinClass() var myEventDetail = { value: this.data.inputvalue } // detail对象,提供给事件监听函数 var myEventOption = { bubbles: true, composed: true } // 触发事件的选项 this.triggerEvent('joinClass', myEventDetail, myEventOption) } } else { this.closePopup() } } else { wx.showToast({ icon: 'error', title: '请选择后确认', }) } }, } })