dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.19k stars 3.64k forks source link

[Bug report] App v-for 渲染组件报错(alpha 版已修复) #1820

Closed auven closed 4 years ago

auven commented 4 years ago

问题描述 小程序和 h5 都不会有这个问题,安卓和 ios 里 v-for 渲染组件都会报错。

复现步骤 https://github.com/auven/vant-weapp-convert-uniapp/blob/master/src/pages/grid/index.vue

实际结果 image

image

[广告] 10:08:18.775 开源不易,需要鼓励。去给 uni-app 项目 点个 star 吧 [不再提示]
[广告] 10:08:18.775 DCloud 2020新春招聘开启,欢迎前端、Android、C++/QT来投简历! 详情点击
10:08:18.842 项目 'vant-weapp-convert-uniapp' 开始编译...
10:08:19.882 编译器版本:2.7.9(v3)详见:https://ask.dcloud.net.cn/article/36599。
10:08:19.883 请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。
10:08:19.898 正在编译中...
10:08:32.184  DONE  Build complete. Watching for changes...
10:08:32.202 项目 'vant-weapp-convert-uniapp' 编译成功。
10:08:32.593 正在启动模拟器...
10:08:35.367 正在安装手机端HBuilder调试基座...
10:08:44.322 正在同步手机端程序文件...
10:08:44.405 同步手机端程序文件完成
10:08:44.465 正在启动应用HBuilder...
10:08:47.627 应用HBuilder已启动(如未启动请手动启动模拟器上的HBuilder应用)...
10:08:47.656 iOS模拟器功能少于真机基座,具体见:http://ask.dcloud.net.cn/article/35508
10:08:50.641 [LOG] : App Launch at App.vue:4 
10:08:50.666 [LOG] : App Show at App.vue:7 
10:12:26.244 [ERROR] : cid unmatched [object Object]
10:12:26.271 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.272 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.304 [ERROR] : cid unmatched [object Object]
10:12:26.336 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.337 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.370 [ERROR] : cid unmatched [object Object]
10:12:26.370 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.370 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.404 [ERROR] : cid unmatched [object Object]
10:12:26.437 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.438 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.438 [ERROR] : cid unmatched [object Object]
10:12:26.472 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.473 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.510 [ERROR] : cid unmatched [object Object]
10:12:26.510 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.510 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.540 [ERROR] : cid unmatched [object Object]
10:12:26.572 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.572 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.572 [ERROR] : cid unmatched [object Object]
10:12:26.601 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.601 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.630 [ERROR] : cid unmatched [object Object]
10:12:26.659 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.659 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
10:12:26.659 [ERROR] : cid unmatched [object Object]
10:12:26.699 [ERROR] : TypeError: Invalid attempt to destructure non-iterable instance.
10:12:26.699 In order to be iterable, non-array objects must have a [Symbol.iterator]() method.

系统信息:

uni-app v2.7.9
uni-app cli v2.0.0-27920200527001

Environment Info:

  System:
    OS: macOS 10.15.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 83.0.4103.106
    Firefox: Not Found
    Safari: 13.0.5
  npmPackages:
    @dcloudio/types: ^1.0.2 => 1.0.2
    @dcloudio/uni-app-plus: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-app-plus-nvue:  0.0.1
    @dcloudio/uni-app-plus-nvue-v8:  0.0.1
    @dcloudio/uni-automator: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-cli-shared: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-h5: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-helper-json: * => 1.0.5
    @dcloudio/uni-migration: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-mp-alipay: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-mp-baidu: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-mp-qq: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-mp-toutiao: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-mp-weixin: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-quickapp-native: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-quickapp-webview: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-stat: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/uni-template-compiler: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/vue-cli-plugin-hbuilderx: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/vue-cli-plugin-uni: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/vue-cli-plugin-uni-optimize: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/webpack-uni-mp-loader: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @dcloudio/webpack-uni-nvue-loader:  0.0.1
    @dcloudio/webpack-uni-pages-loader: ^2.0.0-27920200527001 => 2.0.0-27920200527001
    @hap-toolkit/dsl-vue:  0.6.13
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.1.2
    @vue/babel-preset-app:  4.3.1
    @vue/babel-preset-jsx:  1.1.2
    @vue/babel-sugar-functional-vue:  1.1.2
    @vue/babel-sugar-inject-h:  1.1.2
    @vue/babel-sugar-v-model:  1.1.2
    @vue/babel-sugar-v-on:  1.1.2
    @vue/cli-overlay:  4.3.1
    @vue/cli-plugin-babel: ~4.3.0 => 4.3.1
    @vue/cli-plugin-router:  4.3.1
    @vue/cli-plugin-vuex:  4.3.1
    @vue/cli-service: ~4.3.0 => 4.3.1
    @vue/cli-shared-utils:  4.3.1
    @vue/component-compiler-utils:  3.1.2 (3.1.2)
    @vue/preload-webpack-plugin:  1.1.1
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^6.2.2 => 6.2.2
    mpvue-page-factory:  1.0.1
    mpvue-template-compiler:  1.0.13
    uni-h5-vue:  2.6.10
    uni-mp-vue:  2.6.10
    vue: ^2.6.11 => 2.6.11
    vue-eslint-parser:  7.1.0
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.2 (15.9.2)
    vue-router:  3.0.1
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.11 => 2.6.11
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.2.0 => 3.4.0
  npmGlobalPackages:
    @vue/cli: 4.3.1
fxy060608 commented 4 years ago

该问题已修复: 你可以将@dcloudio相关依赖库升级到最新alpha版本: 2.0.0-alpha-27920200615002

auven commented 4 years ago

@fxy060608 正式版什么时候更新呢?

fxy060608 commented 4 years ago

@fxy060608 正式版什么时候更新呢?

暂无明确时间

auven commented 4 years ago

好嘞,那我先用 alpha 版,等正式版更新了我再关掉这个 issue 。

zhetengbiji commented 4 years ago

正式版已发布

huangxubo23 commented 3 years ago

使用目前最新的正式版本 "@dcloudio/uni-app-plus": "^2.0.0-31920210428001",还是会存在这个问题,请问有解决方案吗?

zhetengbiji commented 3 years ago

使用目前最新的正式版本 "@dcloudio/uni-app-plus": "^2.0.0-31920210428001",还是会存在这个问题,请问有解决方案吗?

确认是同样问题吗?

huangxubo23 commented 3 years ago

使用目前最新的正式版本 "@dcloudio/uni-app-plus": "^2.0.0-31920210428001",还是会存在这个问题,请问有解决方案吗?

确认是同样问题吗?

找到解决方法了,使用v-for如果使用自定义组件,App需要在外层包裹组件:

          <view
            v-for="item of list"
            :key="item.id"
          >
            <DemoComponent :data='item' />
          </view>
zmcode commented 3 years ago

image image 目前已知红米note 9 会存在这个解构对象报错的问题, 其他手机和小程序 h5 都没问题, 不知道为啥会这样