<!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 @click="handleSubmit">提交</button>
</div>
<ul>
<li v-for="(item, index) of list":key="index">
{{item}}
</li>
</ul>
<script>
new Vue({
el:"#root",
data:{
inputValue:'',
list:[]
},
methods:{
handleSubmit:function(){
this.list.push(this.inputValue)
alert('123')
}
}
})
</script>
</body>
</html>
of list":key= 中间没空格?
列表应该放在root挂载点内,你没放进去