<!DOCTYPE html>标签:el,Vue,return,vue,js,013,name2,new,data From: https://blog.51cto.com/u_15356972/6085202
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="root">
<h1>{{name}}</h1>
</div>
<div id="root2">
<h2>{{name2}}</h2>
</div>
<div id="root3">
<h2>{{name3}}</h2>
</div>
<script type="text/javascript">
Vue.config.productionTip = false;
//data的两种写法
new Vue({
el:'#root',
data:{
name:'虾米大王'
}
});
//
new Vue({
el:'#root2',
data:function () {
return {
name2:'虾米们'
}
}
});
//
new Vue({
el:'#root3',
data(){
return{
name3:'海草公主'
}
}
});
</script>
</body>
</html>