Component({ options: { multipleSlots: true, // 在组件定义时的选项中启用多slot支持 addGlobalClass: true, }, properties: { value: { type: String || Number, value: '', }, placeholder: { type: String, value: '请输入搜索关键词', }, focus: { type: Boolean, value: true, }, }, data: {}, methods: { onSearch() { this.triggerEvent('search', this.data.value); }, onChange(e: WechatMiniprogram.TouchEvent) { this.setData({ value: e.detail, }); this.triggerEvent('change', e.detail); }, onClear() { this.triggerEvent('clear'); }, }, });