質問
図に示すように、補間構文は有効になりません。
エラー1
インポートVue
と使用はVue
2 つのタグ内に配置する必要があります
エラー例
<script type="text/javascript" src="./vue.js">
Vue.config.productionTip = true
const x = new Vue({
el: '#root',
data: {
name:"zjh"
}
})
</script>
正しい例
<script type="text/javascript" src="./vue.js"></script>
<script type="text/javascript">
Vue.config.productionTip = true
const x = new Vue({
el: '#root',
data: {
name:"zjh"
}
})
</script>
エラー2
を使用するコードは末尾に配置Vue
する必要があります。javascript
body
エラー例
<html>
<head>
<script type="text/javascript" src="./vue.js"></script>
<script type="text/javascript">
Vue.config.productionTip = true
const x = new Vue({
el: '#root',
data: {
name:"zjh"
}
})
</script>
</head>
<body>
<div id="root">
Hello, {
{
name}}
</div>
</body>
</html>
正しい例
<html>
<head>
<script type="text/javascript" src="./vue.js"></script>
</head>
<body>
<div id="root">
Hello, {
{
name}}
</div>
<script type="text/javascript">
Vue.config.productionTip = true
const x = new Vue({
el: '#root',
data: {
name:"zjh"
}
})
</script>
</body>
</html>