属性或方法“url”未在实例上定义,但在呈现期间被引用。不知道什么意思

CSDN问答 2021-12-30 10:15:27 阅读数:305

实例 方法 url 属性 未在

[Vue warn]: Property or method "url" 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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
[Vue warn]:属性或方法“url”未在实例上定义,但在呈现期间被引用。通过初始化属性,确保此属性在数据选项中或对于基于类的组件是被动的。见:https://vuejs.org/v2/guide/reactivity.html#Declaring-%E5%8F%8D%E5%BA%94%E6%80%A7%E8%B4%A8%E3%80%82




采纳答案:

1、data加个return

export default { data () { return { url: '' } } }

2、引用的时候this指向vue实例


版权声明:本文为[CSDN问答]所创,转载请带上原文链接,感谢。 https://ask.csdn.net/questions/7619816