開始:
1.首先:
在public中創建static檔案夾,在static檔案夾中創建config.js檔案

2.創建完成在public中的index.html引入
<script src="./static/config.js"></script>

3.在config.js寫入
window.server = {
// 后端配置
SERVER_API:"http://..."
}

4.在頁面中使用
//獲取外部鏈接
let confapi = window.server.SERVER_API;
console.log(confapi)
這樣vue就可以讀取外部組態檔
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/336259.html
標籤:其他
上一篇:jQuery(一)—— jQuery 概述 / jQuery 選擇器 / jQuery 樣式操作 / jQuery 效果
下一篇:防抖&節流
