.1. el 直 和 v.$mount
<script type="text/javascript">
Vue.config.productionTip = false //阻止 vue 在启动时生成生产提示。
//el的两种写法
/* const v = new Vue({
//el:'#root', //第一种写法
data:{
name:'尚硅谷'
}
})
console.log(v)
v.$mount('#root') //第二种写法 */
</script>
2.data的两种写法
//data的两种写法
new Vue({
el:'#root',
//data的第一种写法:对象式
/* data:{
name:'尚硅谷'
} */
//data的第二种写法:函数式
data(){ //data=function(), 此处不能用=>(){}, this 会变成window的对象
console.log('@@ @',this) //此处的this是Vue实例对象
return{
name:'尚硅谷'
}
}
})