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
| <template>
| <view>
| <zhangguangsen-search :hotList="hotList" :searchList="searchList" @onInput="onInput" @onSearchConfirm="onSearchConfirm"></zhangguangsen-search>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| hotList:['aa','bb','cc','dd','测试一个超产的龙欧索','aa','bb','cc','dd','测试一个超产的龙欧索'],
| searchList:[]
| }
| },
| mounted(){
| },
| methods: {
| onInput(val){
| console.log('**input',val)
| //模拟后端返回数据,根据val调用接口
| setTimeout(()=>{
| this.searchList = ['aabacd','bb','cc','dd','测试一个超产的龙欧索','aa',Math.random()]//这里模拟 axios 返回的数据
| },2000)
| },
| onSearchConfirm(searchVal){
| console.log('搜索词',searchVal)
| }
| }
| }
| </script>
|
| <style lang="scss">
| </style>
|
|