dcloudio / dcloudio/uni-app

从ts,js文件中导入的vue组件在小程序端不生效

Open
#4,098 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

**问题描述**
[问题描述:尽可能简洁清晰地把问题描述清楚]
在自定义组件目录下的index.ts中统一导入导出组件.vue文件
引用组件时的路径缺省为该组件文件夹的路径(默认为文件夹下的index.ts .js文件)
在h5环境中正常,小程序环境下不正常,编译产物中页面的usingComponents没有发现对引用组件的声明

[或者可以直接贴源代码]
-src/components/BtnCustom/BtnCustom.vue
-src/components/BtnCustom/index.ts
import BtnCustom from './BtnCustom.vue'
export BtnCustom
-src/pages/index/index.vue
import BtnCustom from ‘@/components/BtnCustom’
**预期结果**
[使用简洁清晰的语言描述你希望生效的预期结果]
小程序与h5端表现一致
**实际结果**
[这里请贴上你的报错截图或文字]

**系统信息:**
- 发行平台: 微信小程序
- 操作系统 windows
- HBuilderX版本 [如使用HBuilderX,则需提供 HBuilderX 版本号]
- uni-app版本 3.0.0-3061520221228001
- 设备信息 微信开发者工具

**补充信息**
[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]
编译小程序目标代码时只针对引用.vue做了组件声明,对于通过中间导入导出转换的index.ts(.js)文件暴露出来的组件没有做处理

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.