成功解决:Error in created hook: “ReferenceError: params is not defined“

简介: 该博客文章描述了作者解决"ReferenceError: params is not defined"错误的过程,原因是路由传递的params参数与调用方法中的参数名称冲突,最终通过检查接口参数解决了问题。

狸猫换太子、这个错误找了我一个小时。结果是通过路由形式的params和调用方法中的params碰巧一样了、找的方向错了。调用的方法中没有传params参数。

控制台错误

在这里插入图片描述

1、我要实现的效果

商品首页有大量商品、然后通过点击商品的信息跳转至一个新的页面。然后商品更多的详细信息以及、商品评价展示出来。很简单的业务逻辑

在这里插入图片描述
在这里插入图片描述

2、问题解决的过程

2.1 获取传递的方式不对?

在新的页面中进行插值表达式可以正常获取到传递的数据,在method方法中获取不到?那就提前到mounted,也不行?提前到created中?。获取的方式没问题。

2.2 在后台打断点看看有没有调用方法

没有进入对应的方法,那就是没调用成功啊。查看接口。
我这里对接口进行了封装、在封装的页面发现、少了一个参数。
在这里插入图片描述

3、后语

方向不对,努力白费。学无止境。。。。。。

目录
打赏
0
0
0
0
213
分享
相关文章
|
6月前
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
解决Flutter报错The named parameter |method ‘xxxx‘ isn‘t defined.
253 3
Error in created hook: “TypeError: _test.default is not a function
Error in created hook: “TypeError: _test.default is not a function
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
150 0
Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.
Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.
234 0
error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
133 0
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
Error:error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
206 0
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
307 0
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
error: possibly undefined macro: LT_SYS_SYMBOL_USCORE please use m4_pattern_allow
error: possibly undefined macro: LT_SYS_SYMBOL_USCORE please use m4_pattern_allow
162 0
error: implicit declaration of function ‘VerifyFixClassname‘ is invalid in C99 [-Werror,-Wimplicit-f
error: implicit declaration of function ‘VerifyFixClassname‘ is invalid in C99 [-Werror,-Wimplicit-f
165 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等