Property or method "toJSON" is not defined on the instance but referenced during render. Make sure t

Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property

一直有这个报错。说是属性或方法“tojson”不是在实例上定义的,而是在呈现过程中引用的。确保此属性为通过初始化属性,确保此属性在数据选项中或对于基于类的组件是活动的

最后发现我用了termid这个字段。定义的时候termid:'  ',但是赋值的时候termid=data.id ;但是这个dataid是个数字。最后接口需要字符类型的我又通过termid.toString()转为了字符。

所以初始化定义的数据类型和赋值的数据类型格式不一样时,就会出现这种错误了。

还有种错误我本来定义的是数组。但是最后传给后台的时候必须传字符串。我就把这个数组toSting了。这违背了我开始定义的数组。而赋值成了字符串。这个时候也会报这种错误。

猜你喜欢

转载自blog.csdn.net/qq_33769914/article/details/81902059