index.vue 2.04 KB
<template>
  <div class="self-regulating">
    <nafm-header navClass="nafmii-head-bg3">
      <template slot="bottom">
        <SearchInput v-model="keyword" readonly @click="handleSearch" :placeholder="$t('home.searchPlaceholder')" />
        <div class="nav-placeholder"></div>
      </template>
    </nafm-header>
    <van-tabs v-model="active" animated scrollspy swipe-threshold="3" class="data-tabs">
      <van-tab :title="item.name" v-for="(item,idx) in tabs" :key="idx">
        <DataListLayout :keyword="keyword" :tab="item" />
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import mixinKeepAlive from '@/mixins/mixinKeepAlive'
import { KeywordBus } from '@/utils/eventBus'
import SearchInput from '@/components/SearchInput'
import DataListLayout from './components/DataListLayout'
export default {
  name: 'SelfRegulating',
  mixins: [mixinKeepAlive],
  components: { SearchInput, DataListLayout },
  data () {
    return {
      active: 0,
      keyword: null,
      tabs: []
    }
  },
  methods: {
    handleTabs () {
      setTimeout(() => {
        this.tabs = [
          { id: 1, name: '全部' },
          { id: 2, name: '会员管理' },
          { id: 3, name: '产品创新' },
          { id: 4, name: '注册发行' },
          { id: 5, name: '后续管理' },
          { id: 6, name: '其他' },
        ]
      }, 100);
    },
    handleSearch () {
      this.$router.push({ name: 'SelfRegulatingSearch' })
    },

    initKeywordListener () {
      KeywordBus.on((val) => {
        this.keyword = val
      })
    }
  },
  mounted () {
    this.handleTabs()
    this.initKeywordListener()
  },
  destroyed () {
    KeywordBus.off()
  }
}
</script>


<style lang="less" scoped>
@import '~@/assets/css/tabsmixin.less';

@PlaceholderHeight: 42px;
.self-regulating {
  height: 100%;
  display: flex;
  flex-direction: column;
  .nav-placeholder {
    height: @PlaceholderHeight;
    width: 100%;
  }
  .data-tabs {
    flex: 1;
    z-index: 10;
    margin-top: -@PlaceholderHeight;
    display: flex;
    flex-direction: column;
  }
}
</style>