taro-ui icon indicating copy to clipboard operation
taro-ui copied to clipboard

SwipeAction组件出现异常

Open fengyu-lirm opened this issue 5 years ago • 5 comments

Taro UI 版本信息

2.1.0

问题描述

options/index.js中,componentDidMount执行delayQuerySelector方法得到响应后,在this.props.onQueryedDom(res[0])中发生异常; 异常的原因:res[0]解构时无width属性,导致onQueryedDom执行时异常

复现步骤

本地开发环境暂无法复现

复现代码

本地开发环境暂无法复现

报错信息

错误一:null is not an object (evaluating 'e.width'); [Component] Event Listener Error @ npm/taro-ui/dist/weapp/components/swipe-action/options/index#(anonymous) 错误二:Cannot read property 'width' of null; [Component] Event Listener Error @ npm/taro-ui/dist/weapp/components/swipe-action/options/index#(anonymous)

系统信息

1.2.13

补充信息

fengyu-lirm avatar Aug 06 '19 02:08 fengyu-lirm

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-ui-bot[bot] avatar Aug 06 '19 02:08 taro-ui-bot[bot]

CC @SzHeJason

taro-ui-bot[bot] avatar Aug 08 '19 07:08 taro-ui-bot[bot]

我也遇到了

VM7340:1 Uncaught (in promise) thirdScriptError
Cannot read property 'width' of null
TypeError: Cannot read property 'width' of null
    at Object.AtSwipeAction._this.handleDomInfo [as onQueryedDom] 

millievn avatar Jun 11 '20 07:06 millievn

同样遇到该问题,版本:"taro-ui": "^3.0.0-alpha.3"

VM2523 WAService.js:2 (in promise) MiniProgramError Cannot read property 'width' of null TypeError: Cannot read property 'width' of null at Object.n.handleDomInfo [as onQueryedDom] (http://127.0.0.1:52824/appservice/vendors.js:2:165400) at http://127.0.0.1:52824/appservice/vendors.js:2:163752

synebula avatar Nov 16 '20 02:11 synebula

我也遇到了,看别人说是:

“在taro3.5之后的版本中,在开启prebundle(默认开启)的情况下,会导致ossaui所引用的@taro/components组件没有被打进最终的bundle中,导致页面表现异常。”手动将ossaui排除在prebundle列表之外

随后搜索taro文档:

compiler.prebundle,“是否开启依赖预编译功能。开启后首次编译 Taro 会把项目的 node_modules 依赖打包为模块联邦的 Remote 应用,二次编译时 Webpack 只需要编译项目源码,从而提升编译速度。”“默认值:生产环境为 false,开发环境为 true”

所以当taro版本>=3.5时,taro项目使用taro-ui的正确的配置方式是在config/index.js文件中排除taro-ui

// config/index.js 
module.exports = {
  framework: 'react',
  compiler: {
    type: 'webpack5',
    prebundle: {
      exclude: ['taro-ui']
    }
  },
}

这是一种解决办法,不知道还有没有其他方式避免这个问题?

官方再后续版本会修复吗?

JuvenileQ avatar Mar 01 '24 06:03 JuvenileQ