Component({ properties: { title: { type: String }, type: { type: String, value: "default", //默认类型 switch-开关 }, switchLabel: { type: String }, //开关标签,type==switch生效 switch: { type: Boolean }, //开关属性值,type==switch生效 callBack: { type: Function } }, lifetimes: { attached: function () { getApp().globalData.Language.getLanguagePackage(this) } }, methods: { /* 改变开关状态 */ changeSwitch() { let showAll = !this.data.switch; this.setData({ switch: showAll }) this.triggerEvent("callBack", showAll) } } })