inleft
2022-01-21 f9c38ed1b72fc96b96c1d3ffdcc1a66b03bd3b73
commit | author | age
56a4b8 1 <template>
I 2     <div class="blog-cell ">
3         <div class="blog-container">
4             <div class="blog-user-message blog-cell ">
5                 <span>{{searchType}}</span>
6                 <hr>
7                 <div>
8                     <a-auto-complete v-bind="search" @select="onSelect" @search="onSearch" @change="onChange">
9                         <a-input>
10                             <a-icon slot="suffix" type="search" class="certain-category-icon" />
11                         </a-input>
12                     </a-auto-complete>
13                 </div>
14                 <hr>
15                 <span>{{sentence}}</span>
16             </div>
17         </div>
18     </div>
19
20 </template>
21
22 <script>
23     export default {
24         name: "box",
25         props: {
26             searchType: ""
27         },
28         data() {
29             return {
30                 sentence: "十里寒塘路,烟花一半醒",
31                 search: {
32                     placeholder: "搜索..",
33                     allowClear: true,
34                     // autoFocus: true,
35                     backfill: true,
36                     dataSource: [],
37                 },
38             }
39         },
40         methods: {
41             onSearch(searchText) {
42                 this.dataSource = !searchText ? [] : [searchText, searchText.repeat(2), searchText.repeat(3)];
43                 console.log("补全..");
44             },
45             onSelect(value) {
46                 console.log('回车', value);
47             },
48             onChange(value) {
49                 console.log('修改', value);
50             },
51             keyListener(value) {
52                 console.log('ref', this.$refs.mySearch);
53                 console.log('键盘', value);
54             },
55         },
56     }
57 </script>
58
59 </script>
60
61 <style lang="less">
62
63 </style>