Vue基础-创建vue的对象
Vue基础-创建vue的对象
·
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--1 引入vue的js文件-->
<script src="js/vue-2.6.10.js"></script>
</head>
<body>
<div id="root">
<h2>{{msg}}</h2>
<input type="text" v-model="username"/>
<hr/>
<div>学校的名称:{{school.name}}</div>
<div>学校的名称:{{school.address}}</div>
<hr/>
<div>学员的名称:{{student.name}}</div>
<div>学员的年龄:{{student.age}}</div>
</div>
</body>
</html>
<script>
// 消除开发模式的警告
Vue.config.productionTip=false;
/*创建vue的对象*/
let vm = new Vue({
el:"#root",
data:{
msg:"软件学院",
username:"",
school:{
name:"软件学院",
address:["深圳","广州","上海"],
},
student:{
name:"张三",
age:21
}
}
})
</script>更多推荐



所有评论(0)