// components/zyh_card/zyh_card.js Component({ options: { observers: true }, /** * 组件的属性列表 */ properties: { // 预约时间-label labelTitle: { type: String, value: "预约时间" }, // 预约时间-value valueTitle: { type: String, value: "****-**-** **:**-**:**" }, // 姓名 labelName: { type: String, value: "****: ***" }, // 姓名 labelPhone: { type: String, value: "****: ****" }, // 类型 type: { type: Number, value: 1 } }, /** * 组件的初始数据 */ data: { classType: "wait", text: "待审" }, /** * 组件的方法列表 */ methods: { onClick(e) { this.triggerEvent("click") }, //通过类型判断样式 compareType(type) { var classType = ""; var text = ""; switch (type) { case 0: classType = "wait"; text = "待审"; break; case 2: classType = "pass"; text = "同意"; break; case 1: classType = "reject"; text = "已拒"; break; case 3: classType = "entrance"; text = "入场"; break; default: break; } this.setData({ classType: classType, text: text }); } }, observers: { type: function(type) { this.compareType(type); } } });