这个报错是为啥呀,我按着老师的代码写的呀

来源:4-2 使用vue-cli开发TodoList

慕虎8490328

2021-05-23 16:32

http://img4.mukewang.com/60aa12e70001b31409431080.jpg

<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>


写回答 关注

3回答

  • 慕虎5578975
    2021-10-28 09:19:54
    import todoitem from'./components/todoitem'    from后面加空格


  • 慕虎8490328
    2021-05-24 19:26:54

    好了,自己知道了,我用的IJ,格式要求相当严格,什么东西后面应该是几个空格都规定的很严。

    Youyo1...

    个人的一点点经验谈哈 每改动一点 就下意识的格式化和保存 是个好习惯

    2021-05-25 16:35:14

    共 1 条回复 >

  • Youyo188
    2021-05-24 11:45:10
     @delete=""handleDelete


    慕虎8490...

    这个倒是一个,但不是主要问题

    2021-05-24 19:13:11

    共 1 条回复 >

vue2.5入门

快速理解Vue编程理念上手Vue2.0开发。

146163 学习 · 655 问题

查看课程

相似问题