question
The interpolation syntax does not take effect, as shown in the figure:
Error 1
Import Vue
and use Vue
should be placed within two tags
Error example
<script type="text/javascript" src="./vue.js">
Vue.config.productionTip = true
const x = new Vue({
el: '#root',
data: {
name:"zjh"
}
})
</script>
Correct example
<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>
Error 2
Code using should Vue
be placed at the end ofjavascript
body
Error example
<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>
Correct example
<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>