在vue cli 創(chuàng)建的項目里面, 設(shè)置環(huán)境變量,報錯 not defined問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法相關(guān)代碼// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)\//.env 文件 VUE_APP_TITLE=測試標題 // public/index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <link rel="icon" href="<%= BASE_URL %>favicon.ico"> <title><%= VUE_APP_TITLE %></title> </head> <body> <noscript> <strong>We're sorry but vue-test-3 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> </noscript> <div id="app"></div> <!-- built files will be auto injected --> </body> </html>期望頁面title顯示"測試標題",但是有報錯"ReferenceError: VUE_APP_TITLE is not defined"
添加回答
舉報
0/150
提交
取消