<template>
  <!-- 文章类型页面 -->
  <div class="content">
    <BannerTop :options="bannerTopOptions"/>

    <section class="container pt-4 pb-4">
      <div class="row">
        <AsideTree 
          class="col-md-3 mb-4 mb-md-0" 
          :headerTitle="$t('news.allNews')"
          :treeData="categoryTree"
          baseUrl="/article-page"
        />
        <main class="col-md-9">
          <div class="pretty-header">
            <h2>{{$route.query.title}}</h2>
          </div>
          <nuxt-child />
        </main>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: 'article-page',
  watchQuery: ['maxCatgId', 'title'],
  data() {
    return {
      
    }
  },
  async asyncData({$axios, query}) {
    // 获取新闻分类
    const categoryTree = await $axios.$get(`/web/prodCategory?catgId=${query.maxCatgId}`)
    const bannerTopOptions = {
      title: query.title,
      // subTitle: $t('news.newsCenter'),
      img: require('../assets/image/banner/news-banner.png')
    }
  
    return {
      categoryTree,
      bannerTopOptions
    }
  },
  head() {
    return {
      title: this.bannerTopOptions.title, // 页面标题
      meta: [
        {
          hid: 'keywords',
          name: 'keywords',
          content: this.$t('seo.news.keywords')
        },
        {
          hid: 'description',
          name: 'description',
          content: this.$t('seo.news.description')
        }
      ]
    }
  },
  methods: {
    
  }
}
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
}

</style>