ModuleSearchLayout.vue 1000 Bytes
<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>