vue 读取 外部配置文件
1.首先:
在public中创建static文件夹,在static文件夹中创建config.js文件
2.创建完成在public中的index.html引入
<script src="./static/config.js"></script>
3.在config.js写入
window.server = { //webSocket Url webSocketUrl:"ws://192.168.1.5:5011/chat/", serverApiUrl: "http://192.168.1.5:5012/httpCli" }
4.在页面中使用
HttpUrl = window.server.serverApiUrl;
console.log("AddressGridView "+ HttpUrl );
感谢:繁星如梦&
https://blog.csdn.net/fackyoufack/article/details/120952701?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-120952701-blog-125520975.pc_relevant_3mothn_strategy_and_data_recovery&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-1-120952701-blog-125520975.pc_relevant_3mothn_strategy_and_data_recovery&utm_relevant_index=1