按照如上代码讲uni.redirectTo放在setTimeout中
- 发布:2021-01-30 22:50
- 更新:2021-08-20 14:40
- 阅读:1206
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 3.0.7
手机系统: Android
手机系统版本号: Android 10
手机厂商: 华为
手机机型: mate 40 pro
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常转跳
正常转跳
实际结果:
正常转跳,但是控制台报错
正常转跳,但是控制台报错
bug描述:
基于uniCloudAdmin改造,leftWindow.vue中如下代码
clickMenuItem(url) {
// #ifdef H5
if (url.indexOf('http') === 0) {
return window.open(url)
}
// #endif
// TODO 后续要调整
if (this.toSave > 0) {
uni.showLoading({
title: "正在保存记录..."
})
}
let delay = this.toSave - new Date().getTime();
setTimeout(() => {
uni.redirectTo({
url: url,
success: () => {
// this.changeMenuActive(url)
},
fail: () => {
uni.showModal({
title: '提示',
content: '页面 ' + url + ' 跳转失败',
showCancel: false
})
}
});
uni.hideLoading();
}, delay > 0 ? delay + 1000 : 0)
},
运行后控制台报如下错误:
22:46:31.405 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.426 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.446 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.466 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.487 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.508 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.528 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.549 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.569 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.590 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.611 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.631 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.651 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.672 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.692 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.712 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.732 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.753 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.773 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.793 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.813 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.834 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.855 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.875 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
22:46:31.895 cid unmatched [object Object] at view.umd.min.js:1
22:46:31.916 TypeError: Invalid attempt to destructure non-iterable instance.
22:46:31.936 In order to be iterable, non-array objects must have a [Symbol.iterator]() method. at view.umd.min.js:1
虽然不影响使用,但是很想知道为什么会这样。
1 个回复
Gushxi
同问,