解决:Vue项目中报错为 “TypeError: _this2.getListFn is not a function“ 或 Property or method “inputFn“ is not
1、报错的信息全称为:其一、报错信息为:TypeError: _this2.getListFn is not a function或Property or method "inputFn" is not defined on the instance but referenced during render. Make sure that this property is reactive, ei
1、报错的信息全称为:
其一、报错信息为:
TypeError: _this2.getListFn is not a function
或Property or method "inputFn" 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.
其二、报错的页面展示为:
2、关于该 Vue 项目报错的解析为:
A、可以很清楚的看到:getListFn 函数的定义可能有问题,因为报错为:其不是一个函数;
B、第二句翻译过来就是:
属性或方法 ‘inputFn’ 未在实例上定义,但在渲染期间被引用。 通过初始化属性,确保此属性在数据选项或基于类的组件中是反应性的;
3、出问题的地方及解决的方法:
其一、出问题的地方:
把 getListFn()
和 inputFn()
方法定义在了 methods
方法之外了,即:methods
的大括号的位置看错啦!
其二、解决办法及过程:
将 methods
的大括号的位置修改到正确的位置即可!!
其三、此时的页面是没有问题的,显示结果为:
(即:此时就表示该 vue 项目的过程及 methods 方法没有问题!)
4、小结:
其一、哪里有不对或不合适的地方,还请大佬们多多指点和交流!
其二、有兴趣的话,可以多多关注这个专栏(Vue面试必备专栏):https://blog.csdn.net/weixin_43405300/category_11525646.html?spm=1001.2014.3001.5482
更多推荐
所有评论(0)