feat: 自动引入fly-xxx组件

This commit is contained in:
Burt 2023-12-23 14:32:19 +08:00
parent af06e8b6ad
commit dfabbc6342
4 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,9 @@ export default defineUniPages({
easycom: {
autoscan: true,
custom: {
// 以 Fly 开头的组件,在 components 文件夹中查找引入(需要重启服务器)
'^Fly(.*)': '@/components/fly-$1/fly-$1.vue',
'^fly-(.*)': '@/components/fly-$1/fly-$1.vue',
// uni-ui 规则如下配置
'^uni-(.*)': '@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue',
},

View File

@ -0,0 +1,3 @@
<template>
<view class="text-green-500"> header </view>
</template>

View File

@ -16,6 +16,8 @@
"easycom": {
"autoscan": true,
"custom": {
"^Fly(.*)": "@/components/fly-$1/fly-$1.vue",
"^fly-(.*)": "@/components/fly-$1/fly-$1.vue",
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
},

View File

@ -16,6 +16,7 @@
<uni-badge text="1"></uni-badge>
<!-- Sun in light mode, Moon in dark mode, from Carbon -->
<button class="i-carbon-sun dark:i-carbon-moon" />
<fly-header></fly-header>
</view>
</template>