vue添加上双向数据绑定就报错

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

生物怪兽

2018-07-29 20:18

<template>

  <div>

    <div> 

       <input v-model="inputValue"/>/*这一填上v-model就报错https://img3.mukewang.com/5b5db06d0001c8f705100561.jpg*/

       <button @click="handleclick">提交</button>

    </div>


    <ul>

<todo-item  v-for="(item,index) of list"  :key="index" ></todo-item>

    </ul>


  </div>

</template>


<script>

import todoitem from './components/todoitem'


export default {


    components:{

  'todo-item':todoitem

},

   date : function() {

    return{

          inputValue:'',

          list:[]

          }

  },

   methods:{

   handleclick(){

   this.list.push(this.inputValue)

            this.inputValue=""

   }

   }

}

 


</script>


<style>


</style>


写回答 关注

1回答

  • qq_若鸿鹄_0
    2018-07-31 14:53:28
    已采纳

    你的data写成了date,

    生物怪兽

    非常感谢!

    2018-08-11 14:15:42

    共 1 条回复 >

vue2.5入门

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

146179 学习 · 655 问题

查看课程

相似问题