1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-07-27 04:20:43 +08:00
Files
uni-halo/wot-ui-resolver.ts
T
小莫唐尼 3945ee611d chore: 清理旧文件并重构项目基础结构
- 删除大量废弃的旧代码、依赖和配置文件
- 新增基础项目配置、工具函数、页面模板和请求库
- 重构目录结构,统一项目规范
- 添加commitlint、husky等代码规范工具
2026-06-11 02:13:47 +08:00

28 lines
756 B
TypeScript

import type { ComponentResolver } from '@uni-helper/vite-plugin-uni-components'
import { kebabCase } from '@uni-helper/vite-plugin-uni-components'
/**
* npm 安装的 Wot UI 组件在 H5 端需通过 vite-plugin-uni-components 解析,
* 才能正确挂载组件样式。
*/
export function WotResolver(): ComponentResolver {
return {
type: 'component',
resolve: (name: string) => {
if (name.match(/^Wd[A-Z]/)) {
const compName = kebabCase(name)
return {
name,
from: `@wot-ui/ui/components/${compName}/${compName}.vue`,
}
}
if (name.startsWith('wd-')) {
return {
name,
from: `@wot-ui/ui/components/${name}/${name}.vue`,
}
}
},
}
}