
<template>
??<div>
????<div?>
??????<input?v-model='inputValue'/>
??????<button?@click="handleSubmit">提交</button>
????</div>
????<ul>
??????<todo-item?v-for="(item,index)?of?list"
?????????????????:content="item"
?????????????????:index="'index"
?????????????????@delete=""handleDelete
??????></todo-item>
????</ul>
??</div>
</template>
<script>
import?todoitem?from'./components/todoitem'
??export?default?{
????component?:{
??????'todo-item':todoitem
????},
????data(){
??????return{
????????inputValue:?'',
????????list:[]
??????}
????},
????methods:{
??????handleSubmit(){
????????this.list.push(this.inputValue)
????????this.inputValue=''
??????},
??????handleDelete(index){
????????this.list.splice(index,1)
??????}
????}
??}
</script>
<style>
</style>
2021-10-28
2021-05-24
好了,自己知道了,我用的IJ,格式要求相當(dāng)嚴(yán)格,什么東西后面應(yīng)該是幾個(gè)空格都規(guī)定的很嚴(yán)。
2021-05-24