语法:
- 使用
Vue.createApp(数据对象).mount(css选择器)
1. 数据对象:
规定用data方法返回的对象作为最终数据
实例:
<div id="counter">
Counter: {{ counter }}<!--用两个大括号-->
</div>const Counter = {
data() {
return {
counter: 0
}
}
}
Vue.createApp(Counter).mount('#counter')