generated from thzxcx/vue3
refactor: 解析器
This commit is contained in:
16
utils/resolver.d.ts
vendored
Normal file
16
utils/resolver.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* @Author: peerless_hero peerless_hero@outlook.com
|
||||
* @Date: 2023-07-13 04:11:13
|
||||
* @LastEditors: peerless_hero peerless_hero@outlook.com
|
||||
* @LastEditTime: 2023-07-13 04:15:06
|
||||
* @FilePath: \uni\utils\resolver.d.ts
|
||||
* @Description:
|
||||
*
|
||||
*/
|
||||
declare const _default: (name: string) =>({
|
||||
name: string;
|
||||
as: string;
|
||||
from: string;
|
||||
})
|
||||
|
||||
export default _default
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-06-25 10:56:32
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-06-25 12:41:06
|
||||
* @FilePath: \uni\utils\resolver.ts
|
||||
* @LastEditors: peerless_hero peerless_hero@outlook.com
|
||||
* @LastEditTime: 2023-07-13 04:11:50
|
||||
* @FilePath: \uni\utils\resolver.js
|
||||
* @Description: 自动导入组件的解析器
|
||||
*
|
||||
*/
|
||||
const reg = /[A-Z]/
|
||||
|
||||
function toLower(name: string) {
|
||||
function toLower(name) {
|
||||
let lower = ''
|
||||
for (let i = 0; i <= name.length - 1; i++) {
|
||||
if (reg.test(name[i]))
|
||||
@ -20,7 +20,7 @@ function toLower(name: string) {
|
||||
return lower
|
||||
}
|
||||
|
||||
export default function (name: string) {
|
||||
export default function (name) {
|
||||
if (name.startsWith('Th')) {
|
||||
const componentName = toLower(name.slice(2))
|
||||
return {
|
Reference in New Issue
Block a user