我想在vue cli构建过程中修改索引html。 (vue.config.js)
有什么办法吗?
这是我的索引HTML,看起来像:
<!DOCTYPE html>
<html lang="en">
<head>
<%= foo %>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta charset="utf-8" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title>blabla</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, minimal-ui" />
</head>
<body>
<noscript>
<strong>We're sorry but tera.com-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
</body>
</html>
并且我希望vue / webpack将值1
解析为foo
。
答案 0 :(得分:0)
Vue将附加到ID为app
的DIV上。因此,您的{{foo}}
将超出Vue的范围,无法更改。
您应该研究Single File Components,这样便可以将整个HTML包装在Vue中。