<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
obj: {}
}
},
onLoad() {
this.testFun()
},
methods: {
testFun() {
this.obj = {
'test.name.txt': 'frank',
'test.age.num': '20'
}
setTimeout(() => {
this.title = '测试'
console.log(this.obj)
}, 100)
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
- 发布:2024-07-27 11:56
- 更新:2024-08-15 11:08
- 阅读:143
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: Windows 10 家庭版 19045.4651
HBuilderX类型: 正式
HBuilderX版本号: 4.24
第三方开发者工具版本号: 1.06.2401020
基础库版本号: 3.5.1
项目创建方式: HBuilderX
示例代码:
操作步骤:
直接运行实例代码
直接运行实例代码
预期结果:
正常运行不报错
正常运行不报错
实际结果:
vendor.js? [sm]:4008 [Vue warn]: Error in nextTick: "TypeError: Cannot read property 'name' of null"(env: Windows,mp,1.06.2401020; lib: 3.5.1)
warn @ vendor.js? [sm]:4008
Vue.config.errorHandler @ vendor.js? [sm]:9223
globalHandleError @ vendor.js? [sm]:5272
handleError @ vendor.js? [sm]:5241
(anonymous) @ vendor.js? [sm]:5380
flushCallbacks @ vendor.js? [sm]:5306
Promise.then (async)
timerFunc @ vendor.js? [sm]:5333
nextTick @ vendor.js? [sm]:5388
queueWatcher @ vendor.js? [sm]:7731
update @ vendor.js? [sm]:7873
notify @ vendor.js? [sm]:4122
reactiveSetter @ vendor.js? [sm]:4459
proxySetter @ vendor.js? [sm]:7960
(anonymous) @ index.js? [sm]:171
setTimeout (async)
testFun @ index.js? [sm]:170
onLoad @ index.js? [sm]:161
invokeWithErrorHandling @ vendor.js? [sm]:5256
Vue.__call_hook @ vendor.js? [sm]:9287
_vue.default.__call_hook @ vendor.js? [sm]:1976
pageOptions.methods.onLoad @ vendor.js? [sm]:2290
vendor.js? [sm]:9224 TypeError: Cannot read property 'name' of null
at dn (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Mo._updateValues (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Mo.updateValues (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at c._updateCb (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at c.doUpdates (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at s.w.setData (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Ci.<anonymous> (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Ci.<anonymous> (WAServiceMainContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at VueComponent.patch [as __patch__] (vendor.js? [sm]:9056)
at VueComponent.Vue._update (vendor.js? [sm]:7348)(env: Windows,mp,1.06.2401020; lib: 3.5.1)
vendor.js? [sm]:4008 [Vue warn]: Error in nextTick: "TypeError: Cannot read property 'name' of null"(env: Windows,mp,1.06.2401020; lib: 3.5.1)
warn @ vendor.js? [sm]:4008
Vue.config.errorHandler @ vendor.js? [sm]:9223
globalHandleError @ vendor.js? [sm]:5272
handleError @ vendor.js? [sm]:5241
(anonymous) @ vendor.js? [sm]:5380
flushCallbacks @ vendor.js? [sm]:5306
Promise.then (async)
timerFunc @ vendor.js? [sm]:5333
nextTick @ vendor.js? [sm]:5388
queueWatcher @ vendor.js? [sm]:7731
update @ vendor.js? [sm]:7873
notify @ vendor.js? [sm]:4122
reactiveSetter @ vendor.js? [sm]:4459
proxySetter @ vendor.js? [sm]:7960
(anonymous) @ index.js? [sm]:171
setTimeout (async)
testFun @ index.js? [sm]:170
onLoad @ index.js? [sm]:161
invokeWithErrorHandling @ vendor.js? [sm]:5256
Vue.__call_hook @ vendor.js? [sm]:9287
_vue.default.__call_hook @ vendor.js? [sm]:1976
pageOptions.methods.onLoad @ vendor.js? [sm]:2290
vendor.js? [sm]:9224 TypeError: Cannot read property 'name' of null
at dn (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Mo._updateValues (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Mo.updateValues (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at c._updateCb (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at c.doUpdates (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at s.w.setData (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Ci.<anonymous> (WASubContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at Ci.<anonymous> (WAServiceMainContext.js?t=wechat&s=1722051630391&v=3.5.1:1)
at VueComponent.patch [as __patch__] (vendor.js? [sm]:9056)
at VueComponent.Vue._update (vendor.js? [sm]:7348)(env: Windows,mp,1.06.2401020; lib: 3.5.1)
bug描述:
export default {
data() {
return {
title: 'Hello',
obj: {}
}
},
onLoad() {
this.testFun()
},
methods: {
testFun() {
this.obj = {
'test.name.txt': 'frank',
'test.age.num': '20'
}
setTimeout(() => {
this.title = '测试'
console.log(this.obj)
}, 100)
}
}
}
vue2环境 运行到微信小程序,obj对象中存在test.name.txt这样的key,并且延时设置其他变量,会导致报错
Error in nextTick: "TypeError: Cannot read property 'name' of null"