const app = getApp(); Component({ properties: { ssid: { type: String, value: "" } }, data: { type: true, ssid: "", password: "" }, // 生命周期方法 lifetimes: { attached() { }, detached() { } }, // 组件的方法 methods: { setWiFiName() { this.setData({ ssid: this.properties.ssid, type: true, }) }, passwordInput(e) { this.setData({ password: e.detail.value }) }, inputTypeChange() { this.setData({ type: !this.data.type }) }, setWifiPWD() { this.triggerEvent('wifiEvent', { status: true, data: this.data.password }); } } });