generated from thzxcx/vue3
feat: 自动导入解析器
This commit is contained in:
29
utils/resolver.d.ts
vendored
29
utils/resolver.d.ts
vendored
@ -1,14 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: peerless_hero peerless_hero@outlook.com
|
* @Author: peerless_hero peerless_hero@outlook.com
|
||||||
* @Date: 2023-07-13 04:11:13
|
* @Date: 2023-07-13 04:11:13
|
||||||
* @LastEditors: peerless_hero peerless_hero@outlook.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-07-13 04:15:06
|
* @LastEditTime: 2023-07-13 10:58:35
|
||||||
* @FilePath: \uni\utils\resolver.d.ts
|
* @FilePath: \uni\utils\resolver.d.ts
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const resolverThzxcx: (name: string) =>({
|
type ComponentResolveResult = {
|
||||||
name: string;
|
|
||||||
as: string;
|
}
|
||||||
|
interface ImportInfo {
|
||||||
|
as?: string;
|
||||||
|
name?: string;
|
||||||
from: string;
|
from: string;
|
||||||
})
|
}
|
||||||
|
type SideEffectsInfo = (ImportInfo | string)[] | ImportInfo | string | undefined;
|
||||||
|
interface ComponentInfo extends ImportInfo {
|
||||||
|
sideEffects?: SideEffectsInfo;
|
||||||
|
}
|
||||||
|
type ComponentResolverFunction = (name: string) => ComponentResolveResult;
|
||||||
|
|
||||||
|
/** ThUi 自动导入解析器 */
|
||||||
|
export const resolverThzxcx: ComponentResolverFunction
|
||||||
|
|
||||||
|
/** thorui-uni 自动导入解析器 */
|
||||||
|
export const resolverTui: ComponentResolverFunction
|
||||||
|
|
||||||
|
/** uni-ui 自动导入解析器 */
|
||||||
|
export const resolveruUniUi: ComponentResolverFunction
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zhaojinfeng 121016171@qq.com
|
* @Author: zhaojinfeng 121016171@qq.com
|
||||||
* @Date: 2023-06-25 10:56:32
|
* @Date: 2023-06-25 10:56:32
|
||||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-07-13 10:20:10
|
* @LastEditTime: 2023-07-13 10:55:59
|
||||||
* @FilePath: \uni\utils\resolver.js
|
* @FilePath: \uni\utils\resolver.js
|
||||||
* @Description: 自动导入组件的解析器
|
* @Description: 自动导入组件的解析器
|
||||||
*
|
*
|
||||||
@ -30,3 +30,24 @@ module.exports.resolverThzxcx = function (name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
module.exports.resolverThzxcx = function (name) {
|
||||||
|
if (name.startsWith('Tui')) {
|
||||||
|
const componentName = toLower(name.slice(3))
|
||||||
|
return {
|
||||||
|
name: 'default',
|
||||||
|
as: name,
|
||||||
|
from: `thorui-uni/lib/thorui/tui${componentName}/tui${componentName}.vue`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.resolverUniUi = function (name) {
|
||||||
|
if (name.startsWith('Tui')) {
|
||||||
|
const componentName = toLower(name.slice(3))
|
||||||
|
return {
|
||||||
|
name: 'default',
|
||||||
|
as: name,
|
||||||
|
from: `@dcloudio/uni-ui/lib/uni${componentName}/uni${componentName}.vue`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: zhaojinfeng 121016171@qq.com
|
* @Author: zhaojinfeng 121016171@qq.com
|
||||||
* @Date: 2023-06-25 10:56:32
|
* @Date: 2023-06-25 10:56:32
|
||||||
* @LastEditors: peerless_hero peerless_hero@outlook.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-07-13 04:11:50
|
* @LastEditTime: 2023-07-13 10:58:22
|
||||||
* @FilePath: \uni\utils\resolver.js
|
* @FilePath: \uni\utils\resolver.mjs
|
||||||
* @Description: 自动导入组件的解析器
|
* @Description: 自动导入组件的解析器
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ function toLower(name) {
|
|||||||
return lower
|
return lower
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function resolverThzxcx(name) {
|
export function resolverThzxcx(name) {
|
||||||
if (name.startsWith('Th')) {
|
if (name.startsWith('Th')) {
|
||||||
const componentName = toLower(name.slice(2))
|
const componentName = toLower(name.slice(2))
|
||||||
return {
|
return {
|
||||||
@ -30,3 +30,25 @@ export default function resolverThzxcx(name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolverTui(name) {
|
||||||
|
if (name.startsWith('Tui')) {
|
||||||
|
const componentName = toLower(name.slice(3))
|
||||||
|
return {
|
||||||
|
name: 'default',
|
||||||
|
as: name,
|
||||||
|
from: `thorui-uni/lib/thorui/tui${componentName}/tui${componentName}.vue`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolverUniUi(name) {
|
||||||
|
if (name.startsWith('Uni')) {
|
||||||
|
const componentName = toLower(name.slice(3))
|
||||||
|
return {
|
||||||
|
name: 'default',
|
||||||
|
as: name,
|
||||||
|
from: `@dcloudio/uni-ui/lib/uni${componentName}/uni${componentName}.vue`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user