nuxt.config.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /********** 本地环境 start **********/
  2. const pro = {
  3. baseURL: 'https://www.mtavip.com/api',
  4. host: '192.168.0.74',
  5. //环境变量设置 新闻 拼路径时的根级别路径 多用于a标签 href属性
  6. url:'https://www.mtavip.com'
  7. }
  8. // build 改为true
  9. const isPro = false;
  10. export default {
  11. /*
  12. ** Nuxt rendering mode
  13. ** See https://nuxtjs.org/api/configuration-mode
  14. */
  15. mode: 'universal',
  16. server: {
  17. // port 端口,默认3000,nuxt默认
  18. port: 3000, // default: 3000
  19. // host:连接服务器主机名
  20. host: isPro?pro.host:'localhost' // default: localhost,
  21. },
  22. /*
  23. ** Nuxt target
  24. ** See https://nuxtjs.org/api/configuration-target
  25. */
  26. target: 'server',
  27. /*
  28. ** Headers of the page
  29. ** See https://nuxtjs.org/api/configuration-head
  30. */
  31. head: {
  32. title: process.env.npm_package_name || '',
  33. meta: [
  34. { charset: 'utf-8' },
  35. // { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  36. // 移动端视口
  37. { name: 'viewport', content: 'width=device-width, user-csalable=yes, initial-scale=0.25, minimum-scale=0.1, maximum-scale=0.25' },
  38. { name: 'nuxtConfigDescription', content: process.env.npm_package_description || '' },
  39. {name:'applicable-device',content:'pc'},
  40. { 'http-equiv':"Cache-Control",content:'no-transform' },
  41. { 'http-equiv':"Cache-Control",content:'no-siteapp' },
  42. ],
  43. link: [
  44. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
  45. ],
  46. },
  47. /*
  48. ** Global CSS
  49. */
  50. css: [
  51. 'element-ui/lib/theme-chalk/index.css',
  52. // 移动端栅格
  53. // 'element-ui/lib/theme-chalk/display.css',
  54. '@/assets/scss/main.scss'
  55. ],
  56. /*
  57. ** Plugins to load before mounting the App
  58. ** https://nuxtjs.org/guide/plugins
  59. */
  60. plugins: [
  61. '@/plugins/element-ui', '~/plugins/axios.http', {src:'~plugins/loadsh.js',ssr: false},{src:'~plugins/consult.js',ssr: false},
  62. ],
  63. /*
  64. ** Auto import components
  65. ** See https://nuxtjs.org/api/configuration-components
  66. */
  67. components: true,
  68. /*
  69. ** Nuxt.js dev-modules
  70. */
  71. buildModules: [],
  72. /**
  73. * 环境变量设置 新闻 拼路径时的根级别路径 多用于a标签 href属性
  74. */
  75. env: {
  76. baseUrl: isPro?pro.url:'http://localhost:3000'
  77. },
  78. /**
  79. * loading 进度条样式
  80. */
  81. loading: false,
  82. /*
  83. ** Nuxt.js modules
  84. */
  85. modules: ['@nuxtjs/axios'],
  86. /*
  87. ** Build configuration
  88. ** See https://nuxtjs.org/api/configuration-build/
  89. */
  90. build: {
  91. transpile: [/^element-ui/],
  92. // 异步加载样式 默认false
  93. extractCSS: true
  94. },
  95. axios: {
  96. // node连接服务器地址(调用后台接口地址)
  97. // baseURL: 'http://182.92.186.22:83/api',
  98. baseURL: isPro?pro.baseURL:'http://192.168.0.179:8100',
  99. },
  100. };