<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script type="text/javascript" src="../js/vue.js"></script>
<title>el与data</title>
</head>
<body>
<div id="root">
<h1>
你好,{{name}}
</h1>
</div>
<script>
// //el的两种写法
// const v=new Vue({
// // el:"#root",//第一种写法
// data:{
// name:"xiao bai"
// }
// })
// v.$mount('#root');//第二种写法
const v = new Vue({
el:"#root",//第一种写法
// data: {//data的第一种写法,对象式写法
// name: "xiao bai"
// }
data:function(){
return{//函数写法
name:"xiao bai"
}
}
})
</script>
</body>
</html>