為什么我按視頻寫的代碼都提示data這行有錯????
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="js/vue.js" ></script>
<title>todoList</title>
</head>
<body>
<div id="root">
<input v-model="inputValue"/>
<button v-on:click="handelSubmit">提交</button>
</div>
<ul>?
<li v-for="(item, index) of list":key="index">
{{item}}
</li>
</ul>
<script>
new Vue(function(){
? ? el:"#root",
? data:{
inputValue:'',
list:[]
},
methods:{
handelSubmit:function(){
this.list.push(this.inputValue)
this.inputValue=''
}
}
})
</script>
</body>
</html>
2019-05-06
new Vue里面沒有function,而是個對象。
2019-12-23
2. 創(chuàng)建Vue實例時,沒有function()
2019-12-23
ul沒有在掛載點root下,所以無法進行dom接管