riku
2024-08-14 f2a0ea849099f49a3d2a9c7e5c44d033df22468f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { useLoading } from '../../../behaviors/loading';
 
Component({
  behaviors: [useLoading],
  options: {
    multipleSlots: true, // 在组件定义时的选项中启用多slot支持
  },
  properties: {
    placeholder: '输入关键词搜索',
    // 搜索缓存历史记录存储标签
    historyTag: 'historyWords',
    // 搜索结果
    searchResult: [],
  },
  data: {
    searchValue: '',
    isSearch: false,
    historyWords: [],
    dialog: {
      title: '确认删除当前历史记录',
      showCancelButton: true,
      message: '',
    },
    dialogShow: false,
    deleteType: 0,
    deleteIndex: '',
  },
  lifetimes: {
    attached: function () {
      // 在组件实例进入页面节点树时执行
      let optionList = optionListFunc;
      if (typeof optionListFunc === 'function') {
        optionList = optionListFunc();
      }
      this.setSelectOptions(keyword, optionList);
      this.onInitialValue(keyword);
    },
  },
  methods: {},
});