Error in created hook: "TypeError: Cannot read properties of undefined (reading 'get')"
写Vue 的时候常遇到的错误之一就是XXXXXX未定义,然后来一个undefined
这种问题一般都是创建钩子出错:无法读取未定义的 xxx 属性。
此错误一般多出现在 created() 中, Vue 中数据渲染和DOM 元素渲染是异步的,此时可能会出现加载先后的问题。在DOM 元素渲染未完成的情况下,去操作DOM元素就会出现问题。官方文档中说明this.$nextTick 可解决此问题。
具体 this.$nextTick 是如何解释和定义可参考官方文档
解决方法就是在这里面去实现逻辑:
this.$nextTick(() => {
// 在此处执行你要执行的函数
});
一般初始化页面的时候将函数方法放在created()里面或者mounted()
Error in created hook: "TypeError: Cannot read properties of undefined (reading 'get')"的更多相关文章
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
- // mounted: {}, 原来是 空方法 导致了 vue 的警告 !| [Vue warn]: Error in mounted hook: "TypeError: handlers[i].call is not a function"
// mounted: {}, 原来是 空方法 导致了 vue 的警告 !| vue.runtime.esm.js?2b0e:587 [Vue warn]: Error in mounted hook ...
- Error in mounted hook: "TypeError: handlers[i].call is not a function" 原因
Error in mounted hook: "TypeError: handlers[i].call is not a function" 百度翻译 安装钩子中的错误:" ...
- Vue 报错Error in render: “TypeError: Cannot read properties of null (reading ‘xxx’)” found in
前端vue报错 [Vue warn]: Error in render: "TypeError: Cannot read properties of null (reading 'name' ...
- 解决:error: Cannot fetch repo (TypeError: expected string or buffer)
同步源码,问题重现: Fetching project platform/external/libopus Fetching project repo error: Cannot fetch repo ...
- LINUX软件./configure 配置出现:configure: error: newly created file is older than distributed files!
当在安装tar源码包的时候出现以下报错如何解决? [root@jieniruyan gst-fluendo-mp3-]# ./configurechecking for a BSD-compatibl ...
- configure: error: newly created file is older than distributed files!
在linux下安装软件包的时候,有时候提示 configure: error: newly created file is older than distributed files!Check you ...
- [Angular] ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'name' of undefined
在数据请求完成通过 ionViewDidLoad 展示页面的时候 报错误 : ERROR Error: Uncaught (in promise): TypeError: Cannot read pr ...
- TypeError: Cannot read property '$$' of undefined at HTMLElement._attached.wx.getPlatform._touchstartHandlerForDevtools
TypeError: Cannot read property '$$' of undefined at HTMLElement._attached.wx.getPlatform._touch ...
- "Resuming debugger: error during debugging loop: TypeError: firstViewRangeElement is null"
翻译过来:“重启调试器:错误调试期间循环:TypeError:firstViewRangeElement为空” 写了一个项目,其中使用到了上传图片的插件,在本地上传图片一切正常,发布到服务器却不正常了 ...
随机推荐
- Leetcode-SQL学习计划-SQL入门-1527.患某种疾病的患者【regexp正则表达式匹配】
链接:https://leetcode.cn/problems/patients-with-a-condition/ -- 1527.患某种疾病的患者 -- 链接:https://leetcode.c ...
- 3.7V升压5V,3.7V转5V电路图芯片
锂离子电池在如今是广泛应用存在我们生活中的方方面面的电子产品中.如,电子玩具,美容仪,医疗产品,智能手表,手机,笔记本,电动汽车等等非常多. 锂电池3.7V升压到5V,3.7V转5V稳压输出的电子产品 ...
- Spring框架之IOC入门
1.开发环境 IDEA版本: 2022.1.4 Maven版本:3.8.6 Spring版本:6.0.2 2.案例分析 2.1 自定义Man类 2.2 自定义Company类 2.3 自定义Compa ...
- PyTorch复现AlexNet学习笔记
PyTorch复现AlexNet学习笔记 一篇简单的学习笔记,实现五类花分类 这里只介绍复现的工作,如果想了解更多有关网络的细节,请去看论文<ImageNet Classification wi ...
- 利用Git同步思源笔记
旧文章从语雀迁移过来,原日期为2022-10-22 思源笔记是一款优秀的本地优先的双链大纲笔记软件,拥有强大的笔记编辑功能且都是免费,唯一付费的就是云同步等一些服务了.但如果暂时还用不着云同步的,我们 ...
- 分享一个自己项目中用到的.net中正则替换工具处理类(支持先用特征匹配内容整体模板,同时模板内对相关字内容进行替换)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- win10 WSL2问题解决“WslRegisterDistribution failed with error: 0x800701bc”
win10安装wsl过程报错信息如下: 造成该问题的原因是WSL版本由原来的WSL1升级到WSL2后,内核没有升级,前往微软WSL官网下载安装适用于 x64 计算机的最新 WSL2 Linux 内核更 ...
- Js/Jq 截图并上传
今天想做一个 Js + Jq 截取网页图并上传到后端,经过一番折腾最终达到了效果. 1·首先需要用到一个非常强大的外部依赖库 html2canvas html2canvas 官网:html2canva ...
- S2-009 CVE-2011-3923
漏洞名称 CVE-2011-3923 S2-009 远程代码执行漏洞 利用条件 Struts 2.0.0 - Struts 2.3.1.1 漏洞原理 OGNL提供了广泛的表达式评估功能等功能.该漏洞允 ...
- Axure 环境进度条
步骤一:拖拉摆放好相关控件 1.4个半圆环,一个白色上半圆环 (上白),一个白色下半圆环 (下白),一个灰色上半圆环 (上灰),一个灰色下半圆环 (下灰),排放层次为: 下灰<下白<上灰& ...