ModuleSearchLayout.vue
1000 Bytes
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
<template>
<section class="module-search-layout">
<nafm-header :navClass="navClass || 'nafmii-head-bg3'">
<template slot="bottom">
<SearchInput v-model="keyword" @search="handleSearch" :placeholder="placeholder || $t('home.searchPlaceholder')" />
</template>
</nafm-header>
<main>
<SearchHistory :stateKey="stateKey" @jumpPage="handleSearch" />
</main>
</section>
</template>
<script>
import SearchInput from './SearchInput'
import SearchHistory from './SearchHistory'
export default {
name: 'ModuleSearchLayout',
components: { SearchInput, SearchHistory },
props: {
navClass: String,
placeholder: String,
stateKey: String,
defKeyword: String
},
data () {
return {
keyword: this.defKeyword
}
},
methods: {
handleSearch (val) {
const param = { stateKey: this.stateKey, value: val }
this.$store.dispatch('search/APushSearchValue', param)
this.$emit('onSearch', val)
}
},
}
</script>