// component/myInfo/myInfo.ts Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { region: ['北京市', '北京市', '海淀区'], schoolArray: ['中国', '美国', '巴西', '日本'], schoolIndex: 0, classArray: ['一年级一班', '一年级2班', '一年级3班', '一年级4班'], classIndex: 0, isShowPassWord: true }, /** * 组件的方法列表 */ methods: { bindSchoolPicker: function (event: any) { let newArray; switch (Number(event.detail.value)) { case 0: newArray = ["一", "二", "三"]; this.setData({ classArray: newArray, classIndex: 0 }) break; case 1: newArray = ["4", "5", "6"]; this.setData({ classArray: newArray, classIndex: 0 }) break; case 2: newArray = ["as", "ad", "af"]; this.setData({ classArray: newArray, classIndex: 0 }) break; case 3: newArray = ["b1", "b2", "b3"]; this.setData({ classArray: newArray, classIndex: 0 }) break; } this.setData({ schoolIndex: event.detail.value }) }, bindClssPicker: function (event: any) { this.setData({ classIndex: event.detail.value }) }, showPwdTab: function () { if (this.data.isShowPassWord) { this.setData({ isShowPassWord: false }) } else { this.setData({ isShowPassWord: true }) } } } })