[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime – declar

报错详情图:

[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declar

[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime – declare it upfront in the data option.

大概意思就是说 避免在运行时向Vue实例或其根$data添加反应性属性-在数据选项中预先声明它。

他让我们在$data添加属性,我们就进行添加

可以先在按钮里面定义一个属性,名字随意,如图

[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declar

 然后在data里面将他return回去就行

[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declar

 报错消失,问题解决

希望能有所帮助

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/4618748fa4.html