配置vue项目的自定义config.js


【1】不采用脚手架的config文件夹中的配置文件

【2】在static文件夹下,自定义一个congfig.js文件

// 配置开发环境下服务器地址
window.Glod = {
  pmsApiUrl: 'https://xxxxxx', 
  pmsApiPort: '29999'
}

 // 配置测试环境下服务器地址
window.Glot = {
  pmsApiUrl: 'https://xxxxxx',
  pmsApiPort: '9999'
}

// 配置生产环境下服务器地址
window.Glop = {
  pmsApiUrl: 'https://xxxxxx', 
  pmsApiPort: '9999'
}

 【3】在index.html中引入

<script type="text/javascript">
      document.write("<script src=<%= htmlWebpackPlugin.options.path %>/config.js?v=" + new Date().getTime() + "><\/script>");
</script>

 

 

相关博文:

https://blog.csdn.net/Amy_cloud/article/details/91873507

https://blog.csdn.net/u014054437/article/details/82970725

 https://www.jb51.net/article/139716.htm


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM