wangguoyu 4 роки тому
батько
коміт
8331cc3992
4 змінених файлів з 21 додано та 20 видалено
  1. 2 1
      components/header.vue
  2. 17 19
      nuxt.config.js
  3. 1 0
      package.json
  4. 1 0
      plugins/loadsh.js

+ 2 - 1
components/header.vue

@@ -34,7 +34,9 @@
 </template>
 
 <script>
+  let _ = require('lodash')
   export default {
+
     name:       'mtaHeader',
     props:      {
       activeNav: { // 默认选中的 路径 与组件中的index相互对应
@@ -110,7 +112,6 @@
       activeIndexSync() {
         const path = this.$route.path;
          console.log(path);
-         return
         const idx = _.findIndex(this.headerArr, function (o) {
           return o.keyPath === path;
         });

+ 17 - 19
nuxt.config.js

@@ -1,34 +1,33 @@
-
 export default {
   /*
   ** Nuxt rendering mode
   ** See https://nuxtjs.org/api/configuration-mode
   */
-  mode: 'universal',
+  mode:         'universal',
   /*
   ** Nuxt target
   ** See https://nuxtjs.org/api/configuration-target
   */
-  target: 'server',
+  target:       'server',
   /*
   ** Headers of the page
   ** See https://nuxtjs.org/api/configuration-head
   */
-  head: {
+  head:         {
     title: process.env.npm_package_name || '',
-    meta: [
+    meta:  [
       { charset: 'utf-8' },
       { name: 'viewport', content: 'width=device-width, initial-scale=1' },
-      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
+      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
+    ],
+    link:  [
+      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
     ],
-    link: [
-      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
-    ]
   },
   /*
   ** Global CSS
   */
-  css: [
+  css:          [
     'element-ui/lib/theme-chalk/index.css',
     { src: '~assets/scss/main.scss', lang: 'scss' },
   ],
@@ -36,31 +35,30 @@ export default {
   ** Plugins to load before mounting the App
   ** https://nuxtjs.org/guide/plugins
   */
-  plugins: [
-    '@/plugins/element-ui','~/plugins/axios.http'
+  plugins:      [
+    '@/plugins/element-ui', '~/plugins/axios.http', {src:'~plugins/loadsh.js',ssr: false},
   ],
   /*
   ** Auto import components
   ** See https://nuxtjs.org/api/configuration-components
   */
-  components: true,
+  components:   true,
   /*
   ** Nuxt.js dev-modules
   */
-  buildModules: [
-  ],
+  buildModules: [],
   /*
   ** Nuxt.js modules
   */
-  modules: ['@nuxtjs/axios'],
+  modules:      ['@nuxtjs/axios'],
   /*
   ** Build configuration
   ** See https://nuxtjs.org/api/configuration-build/
   */
-  build: {
+  build:        {
     transpile: [/^element-ui/],
   },
-  axios: {
+  axios:        {
     baseURL: 'http://192.168.0.179:8100', // Used as fallback if no runtime config is provided
   },
-}
+};

+ 1 - 0
package.json

@@ -12,6 +12,7 @@
     "@nuxtjs/axios": "^5.12.1",
     "css-loader": "^4.2.1",
     "element-ui": "^2.13.2",
+    "lodash": "^4.17.20",
     "node-sass": "^4.14.1",
     "nuxt": "^2.14.0",
     "postcss-loader": "^3.0.0",

+ 1 - 0
plugins/loadsh.js

@@ -0,0 +1 @@
+let _ = require('lodash')