search.vue 1.32 KB
<template>
  <div class="resIssue_search_container">
    <NafmHeader title="注册发行" navClass="nafmii-head-bg3">
      <template #bottom>
        <SearchInput v-model="keyword" placeholder="请输入企业名称/注册报告名称/主承销商" @search="handleSearch" />
      </template>
    </NafmHeader>
    <div class="resIssue_search_content">
      <SearchHistory :list="list" @jumpPage="jumpDetail" @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)
      }
    },
    jumpDetail(val) {

    },
    handleClear() {
      this.list = []
      removeLocalStorage('resIssucessData')
    }
  }
}
</script>
<style lang="less" scoped>
</style>