wangguoyu 4 лет назад
Родитель
Сommit
9a5f163e56
1 измененных файлов с 14 добавлено и 2 удалено
  1. 14 2
      pages/news/_id.vue

+ 14 - 2
pages/news/_id.vue

@@ -44,6 +44,7 @@
   export default {
     name:     'news_id',
     layout:   'templateB',
+
     async asyncData({ params, $axios, store }) {
       // 设置选中菜单
       store.commit('setActiveNav', '/news');
@@ -55,8 +56,7 @@
         const res = await $axios.post(url, opt);
         const url2 = '/home/news/newest';
         const res2 = await $axios.post(url2);
-
-
+          console.log(res);
         return {
           infoData:   res.data.data,
           newestData: res2.data.data.data,
@@ -65,6 +65,18 @@
         return {};
       }
     },
+    head(){
+      return {
+        title: this.infoData.keyword,
+        meta: [
+          {
+            hid: this.infoData.keyword,
+            name: 'description',
+            content: this.infoData.intro
+          }
+        ]
+      }
+    },
     computed: {
       baseUrl() {
         return this.getBaseUrl;