uni-app u-popup和u-select打包后报e.__HOLDER__ is not a function
uni-app u-popup和u-select打包后报e.HOLDER is not a function
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Windows | 11 | HBuilderX |
操作步骤:
- uniapp使用uview打包后mp-weixin代码中出现
HOLDER
方法,并且在调用相关组件时报错
预期结果:
- 不报错
实际结果:
- 报错
bug描述:
- npm run dev:mp-weixin 打包后,
- u-popup和u-select 会报
e.HOLDER is not a function
- 和 Property or method “HOLDER” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
- uview-ui : 1.8.7
- “@dcloudio/uni-mp-weixin”: 2.0.0-alpha-33020211130001
更多关于uni-app u-popup和u-select打包后报e.__HOLDER__ is not a function的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
更多关于uni-app u-popup和u-select打包后报e.__HOLDER__ is not a function的实战教程也可以访问 https://www.itying.com/category-93-b0.html
这个问题是由于uView UI组件库版本与uni-app编译器的兼容性问题导致的。以下是解决方案:
- 主要原因:
- uView 1.x版本与较新的uni-app编译器存在兼容性问题
- 特别是
__HOLDER__
方法在编译过程中被错误处理
- 解决方案: 推荐升级uView到2.0版本:
npm install uview-ui@2.0.31
- 如果必须使用1.x版本,可以尝试:
- 在manifest.json中配置"transformOnly"为true
"mp-weixin": {
"optimization": {
"subPackages": true,
"transformOnly": true
}
}