- 这里msg的效果,在app.mount('#box')后就被覆盖掉了
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="box">
这里msg的效果,在app.mount('#box')后就被覆盖掉了
msg:{{msg}}
</div>
Good!
</body>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const user = {
data(){
return{
msg:'hello',
n:5,
}
},
template: `
{{n}}
<button @click="add">+1</button>
`,
methods:{
add(){
this.n++;
return this.n;
}
}
}
const app = Vue.createApp(user);
const rc = app.mount("#box");
</script>
</html>
标签:box,4.7,const,app,msg,return,mount
From: https://www.cnblogs.com/pansidong/p/17285523.html