[Vue warn]: Property or method "todoName" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option,

发布时间 2023-08-06 14:41:53作者: 捞起月亮的小北

错误原因

先上报错截图

报错翻译 :

解决办法

首先需要保证初始化属性时该属性是被动的,两种情况

  1. 是在数据选项中,
  2. 是一些基于类的组件。

在vue的template中使用了该属性 ,但是在data 或者 methods中还并没有被定义,就被使用了,造成了这个错误。在data中定义一下这个数据或者在methods中声明一下这个函数,即可