Component({ properties: { /** * 键盘类型 * 1:省份简称 * 2:蓝牌普通车牌:车牌号数字+字母 * 3:新能源车牌 */ keyboardType: { type: Number, value: 1 }, }, data: { keyboard: [], show: false, provinces: [ ['京', '津', '沪', '渝', '苏', '浙', ' 豫', '粤', '川', '陕'], ['冀', '辽', '吉', '皖', '闽', '鄂', '湘', '鲁', '晋', '黑'], ['赣', '贵', '甘 ', '桂', '琼', '云', '青', '蒙', '藏', '宁'], ['新', '使', '领', '警', '港', '澳', '台', '学', { value: '', backspace: true }], ], nomals: [ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K'], ['L', 'M', 'N', { value: 'O', disabled: true }, 'P', 'Q', 'R', 'S', 'T', 'U'], ['V', 'W', 'S', 'Y', 'Z', '学', { value: '澳', disabled: true }, { value: '港', disabled: true }, { value: '', backspace: true }], ], ecos: [ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K'], ['L', 'M', 'N', { value: 'O', disabled: true }, 'P', 'Q', 'R', 'S', 'T', 'U'], ['V', 'W', 'S', 'Y', 'Z', { value: '学', disabled: true }, { value: '澳', disabled: true }, { value: '港', disabled: true }, { value: '', backspace: true }], ] }, lifetimes: { created() {}, attached() { this.change(this.properties.keyboardType); }, detached() {} }, methods: { change(keyboardType) { switch (parseInt(keyboardType)) { case 1: this.setData({ keyboard: this.data.provinces }); break; case 2: this.setData({ keyboard: this.data.nomals }); break; case 3: this.setData({ keyboard: this.data.ecos }); break; } }, show() { if (!this.data.show) { this.setData({ show: true }); } }, hide(e) { this.setData({ show: false }); }, delete(e) { this.triggerEvent('delete'); }, click(e) { this.triggerEvent('click', e.target.dataset.value); } } })