如果我想达到按回车键也能达到提交的效果如何修改代码?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>todolist</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js">
</script>
</head>
<body>
<div id="root">
<div>
<input v-model="inputVlue" />
<button @click="handleSubmit">提交</button>
<ul>
<li v-for="(item,index) of list" :key="index">{{item}}</li>
</ul>
</div>
</div>
<script type="text/javascript">
new Vue({
el:"#root",
data:{
inputVlue:'',
list:[]
},
methods:{
handleSubmit:function(){
this.list.push(this.inputVlue);
this.inputVlue='';
}
}
})
</script>
</body>
</html>