日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 Vue 正文

vue3 開發調試階段,本地解決api請求跨域的問題!

作者:wanmeifengfeng 更新時間: 2022-04-04 Vue

根目錄下的vue.config.js文件配置下面沒有備注的內容,如果沒有vue.config.js文件可以手動創建一個復制下面代碼!

module.exports = {
    // outputDir: 'dist',   //build輸出目錄
    // assetsDir: 'assets', //靜態資源目錄(js, css, img)
    // lintOnSave: false, //是否開啟eslint
    devServer: {
        // open: true, //是否自動彈出瀏覽器頁面
        // host: "localhost", 
        // port: '8081', 
        // https: false,   //是否使用https協議
        // hotOnly: false, //是否開啟熱更新
        // proxy: null,
		 proxy: {
		            '/ea55_api': {
		                target: 'http://127.0.0.1:8085/index.php', //API服務器的地址
		                ws: true,  //代理websockets
		                changeOrigin: true, // 虛擬的站點需要更管origin
		                pathRewrite: {   //重寫路徑 比如'/api/aaa/ccc'重寫為'/aaa/ccc'
		                    '^/ea55_api': ''
		                }
		            }
		        },
    }
}

原文鏈接:https://blog.csdn.net/wanmeifengfeng/article/details/115767984

欄目分類
最近更新