search.vue
1.63 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template>
<div class="resIssue_search_container">
<NafmHeader title="注册发行" navClass="nafmii-head-bg3">
<template #bottom>
<SearchInput class="common_search" v-model="keyword" placeholder="请输入企业名称/注册报告名称/主承销商" @search="jumpSearchResult" />
</template>
</NafmHeader>
<div class="resIssue_search_content">
<SearchHistory :list="list" @jumpPage="jumpSearchResult" @clear="handleClear" />
</div>
</div>
</template>
<script>
import SearchInput from '@/components/SearchInput.vue'
import SearchHistory from '@/components/SearchHistory'
import { setLocalStorage, getLocalStorage, removeLocalStorage } from '@/utils/LocalStorage'
export default {
name: 'ResIssueSearch',
components: {
SearchInput,
SearchHistory
},
data() {
return {
keyword: '',
list: []
}
},
mounted() {
this.list = getLocalStorage('resIssucessData') || []
},
methods: {
handleSearch(val) {
if (this.list.indexOf(val) === -1) {
this.list.unshift(val)
if (this.list.length > 10) {
this.list.pop()
}
setLocalStorage('resIssucessData', this.list)
}
},
jumpSearchResult(val) {
this.handleSearch(val)
this.$router.push({
name: 'RegIssueSearchResult',
query: {
keyword: val
}
})
},
handleClear() {
this.list = []
removeLocalStorage('resIssucessData')
}
}
}
</script>
<style lang="less" scoped>
.resIssue_search_container{
display: flex;
flex-direction: column;
height: 100%;
}
.resIssue_search_content{
flex: 1;
}
</style>