Component({ options: { // multipleSlots: true, // 在组件定义时的选项中启用多slot支持 }, /** * 组件的属性列表 */ properties: { width: { type: String, value: '', // 按钮宽度 }, placeholder: { type: String, value: '请输入文字', }, }, /** * 组件的初始数据 */ data: {}, lifetimes: { attached() { (this as any).words = ''; }, }, /** * 组件的方法列表 */ methods: { onConfirm(e: WechatMiniprogram.Input) { let { value } = e.detail; // (this as any).words = value; value = value.replace(' ', ''); if (value.length > 0) { this.triggerEvent('onConfirm', { value }); } }, // onTap() { // this.triggerEvent('onTap', { words: (this as any).words }); // }, }, });