nuxt.config.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. export default {
  2. // Global page headers: https://go.nuxtjs.dev/config-head
  3. head: {
  4. title: '',
  5. htmlAttrs: {
  6. lang: 'zh'
  7. },
  8. meta: [
  9. {charset: 'utf-8'},
  10. {name: 'viewport', content: 'width=device-width, initial-scale=1'},
  11. {hid: 'description', name: 'description', content: ''},
  12. {name: 'format-detection', content: 'telephone=no'}
  13. ],
  14. link: [
  15. {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'}
  16. ]
  17. },
  18. ssr: true,
  19. // Global CSS: https://go.nuxtjs.dev/config-css
  20. css: [
  21. '@/assets/css/element-variables.scss',
  22. '@/assets/css/common.scss',
  23. '@/assets/css/reset.scss',
  24. 'swiper/css/swiper.css',
  25. '@/assets/css/element.scss',
  26. '@/assets/fonts/iconfont.css'
  27. ],
  28. // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  29. plugins: [
  30. '@/plugins/element-ui',
  31. {src: '@/plugins/vue-awesome-swiper', mode: 'client'},
  32. '@/plugins/axios',
  33. '@/plugins/init',
  34. ],
  35. // Auto import components: https://go.nuxtjs.dev/config-components
  36. components: true,
  37. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  38. buildModules: [],
  39. // Modules: https://go.nuxtjs.dev/config-modules
  40. modules: [
  41. // https://go.nuxtjs.dev/axios
  42. '@nuxtjs/axios',
  43. '@nuxtjs/style-resources',
  44. ],
  45. // Axios module configuration: https://go.nuxtjs.dev/config-axios
  46. axios: {},
  47. // Build Configuration: https://go.nuxtjs.dev/config-build
  48. build: {
  49. transpile: [/^element-ui/],
  50. },
  51. router: {
  52. middleware: 'route', // 即每次路由跳转会调用该中间件
  53. base: '/pc/'
  54. //多个中间件写法
  55. // middleware: ['route']
  56. },
  57. styleResources: {
  58. scss: "./assets/css/variables.scss"
  59. },
  60. env: {
  61. baseUrl: process.env.NODE_ENV == 'production' ? 'http://localhost:3000' : 'http://localhost:3001'
  62. }
  63. }