鸿蒙运行提示 [Vue warn]: Failed to resolve component: cell\nIf this is a。。。
鸿蒙运行提示 [Vue warn]: Failed to resolve component: cell\nIf this is a。。。
信息类别 | 详细信息 |
---|---|
产品分类 | uniapp/App |
PC开发环境 | Mac |
PC版本号 | macos 15.3.2 |
HBuilderX | 正式 |
HBuilderX版本号 | 4.57 |
手机系统 | HarmonyOS NEXT |
手机系统版本号 | HarmonyOS NEXT Developer Beta2 |
手机厂商 | 模拟器 |
手机机型 | 鸿蒙模拟器 |
页面类型 | nvue |
vue版本 | vue3 |
打包方式 | 云端 |
项目创建方式 | HBuilderX |
示例代码:
<list id="page" class="page" ref="pagemain" :bounce="true" :enable-back-to-top="true" :show-scrollbar="false" isSwiperList="true" @scroll="page_onScroll">
<zRefresh @refresh="onrefresh(index1)" :refreshing="refreshing" @pullingdown="onpullingdown"
refreshText="refreshText">
</zRefresh>
<!-- 不固定,随着竖向滚动条滑动 -->
<cell>
<view id="intro-box" class="intro-box" ref="intro_box">
<view class="backtop" ref="topRef" style="height: 0;"></view>
/////////省略代碼
</view>
</view>
</cell>
</list>
操作步骤:
- 运行到鸿蒙模拟器
预期结果:
- 错
实际结果:
- 以上报错
bug描述:
在安卓、ios运行都没有问题
在鸿蒙上运行出现以下报错,页面混乱。
[Vue warn]: Failed to resolve component: cell
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:22.972 [Vue warn]: Failed to resolve component: waterfall
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:22.972 [Vue warn]: Failed to resolve component: list
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:22.983 [Vue warn]: Failed to resolve component: refresh
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Z2Refresh onRefresh=fn refreshing=false onPullingdown=fn<bound onpullingdown> …>
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:22.983 [Vue warn]: Failed to resolve component: loading-indicator
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Z2Refresh onRefresh=fn refreshing=false onPullingdown=fn<bound onpullingdown> …>
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:22.993 ReferenceError: dom is not defined
23:16:22.993 at Proxy.readyStart (app-service.js:9029:9)
23:16:22.993 at Proxy.onReady (app-service.js:8979:12)
23:16:22.993 at callWithErrorHandling (http://localhost/file12.js:3075:21)
23:16:22.993 at callWithAsyncErrorHandling (http://localhost/file12.js:3082:17)
23:16:22.993 at Array.<anonymous> (http://localhost/file12.js:5559:19)
23:16:22.993 at invokeArrayFns2 (http://localhost/file12.js:625:19)
23:16:22.994 at invokeHook (http://localhost/file12.js:16265:21)
23:16:22.994 at http://localhost/file12.js:20188:13
23:16:23.226 [Vue warn]: Failed to resolve component: cell
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:23.226 [Vue warn]: Failed to resolve component: waterfall
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
23:16:23.226 [Vue warn]: Failed to resolve component: list
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <Home pageId=1 pagePath=“pages/home/home” pageQuery= { … } …>
更多关于鸿蒙运行提示 [Vue warn]: Failed to resolve component: cell\nIf this is a。。。的实战教程也可以访问 https://www.itying.com/category-93-b0.html
更多关于鸿蒙运行提示 [Vue warn]: Failed to resolve component: cell\nIf this is a。。。的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
这个错误是因为在HarmonyOS NEXT环境下,uni-app的nvue组件解析出现了问题。具体来说:
-
主要错误是Vue无法解析
cell
、list
等原生组件,提示需要将这些组件标记为自定义元素。 -
对于HarmonyOS NEXT环境,需要特别注意:
- 确保HBuilderX版本是最新的(当前4.57可能还不够新)
- 检查manifest.json中是否配置了HarmonyOS支持
- nvue页面在HarmonyOS上的支持可能还不完善
- 临时解决方案:
// 在main.js或页面脚本中添加
import { createApp } from 'vue'
const app = createApp(App)
app.config.compilerOptions.isCustomElement = tag =>
['cell', 'list', 'refresh', 'loading-indicator'].includes(tag)