1***@qq.com
1***@qq.com
  • 发布:2023-06-13 15:14
  • 更新:2024-04-03 11:22
  • 阅读:754

【报Bug】使用vant weapp组件提示 Failed to resolve component: van-button

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.5.3

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: 红米k40

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template>  
    <view class="content">  
        <image class="logo" src="/static/logo.png"></image>  
        <view class="text-area">  
            <van-button type="danger"></van-button>  
        </view>  
    </view>  
</template>

操作步骤:

1.HBuilder创建vue3项目
2.下载vant weapp依赖

npm i @vant/weapp -S --production

3.项目根目录下创建wxcomponents,将依赖中的组件统一移动到该文件夹下
4.在page.json中的配置

    "globalStyle": {  
        "usingComponents": {  
            "van-button": "/wxcomponents/vant/button/index"  
        }  
    },

5.在页面使用标签

 <van-button type="danger">按钮</van-button>

6.运行Android app基座

预期结果:

正常

实际结果:

[Vue warn]: Failed to resolve component: van-button
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

bug描述:

正常使用vant组件,在vue2中使用正常,在vue3环境中一直提示Failed to resolve component: van-button

2023-06-13 15:14 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

引入情况如图

1***@qq.com

1***@qq.com

同样的问题,请问解决了吗

1***@qq.com

1***@qq.com

请问现在这个问题解决了吗

d***@anylink.io

d***@anylink.io

我使用 uview-plus组件库,配置了easycom 规则,启动到浏览器端同样这个错误 [Vue warn]: Failed to resolve component: u-popup
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
HBX 4.0.8 4.0.6 都有这个问题。之前的一个旧项目就没问题

要回复问题请先登录注册