im-ui-mobile 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -23
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8,11 +8,9 @@ import { UViewPlusPlugin } from './plugins/uview-plus.js'
|
|
|
8
8
|
// ImChat
|
|
9
9
|
// ]
|
|
10
10
|
|
|
11
|
-
// #ifdef APP || H5
|
|
12
11
|
const importFn = import.meta.glob('./components/im-*/im-*.vue', { eager: true })
|
|
13
12
|
const components = [];
|
|
14
13
|
|
|
15
|
-
// 批量注册全局组件
|
|
16
14
|
for (const key in importFn) {
|
|
17
15
|
const component = importFn[key].default;
|
|
18
16
|
|
|
@@ -22,34 +20,16 @@ for (const key in importFn) {
|
|
|
22
20
|
.replace('.vue', '') // 去掉 .vue 后缀
|
|
23
21
|
.replace(/\b\w/g, l => l.toUpperCase()) // 首字母大写,如 ImButton
|
|
24
22
|
|
|
25
|
-
//
|
|
26
|
-
const toPascalCase = (str) => {
|
|
27
|
-
return str
|
|
28
|
-
.replace(/im-/, '') // 去掉 im- 前缀
|
|
29
|
-
.split('-')
|
|
30
|
-
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
31
|
-
.join('');
|
|
32
|
-
}
|
|
33
|
-
const pascalName = 'Im' + toPascalCase(fileName.replace('.vue', ''));
|
|
34
|
-
|
|
35
|
-
// 2. 正确的安装方法
|
|
23
|
+
// 2. 添加到组件列表
|
|
36
24
|
if (component) {
|
|
37
25
|
// 如果组件本身没有 name,给它设置一个
|
|
38
26
|
if (!component.name) {
|
|
39
|
-
component.name =
|
|
27
|
+
component.name = componentName;
|
|
40
28
|
}
|
|
41
|
-
|
|
42
|
-
// 添加 install 方法
|
|
43
|
-
// component.install = function (app) {
|
|
44
|
-
// app.component(component.name || pascalName, component);
|
|
45
|
-
// };
|
|
46
|
-
|
|
47
|
-
// 添加到组件列表
|
|
29
|
+
|
|
48
30
|
components.push(component);
|
|
49
|
-
console.log(`注册组件: ${component.name || pascalName}`);
|
|
50
31
|
}
|
|
51
32
|
}
|
|
52
|
-
// #endif
|
|
53
33
|
|
|
54
34
|
const install = (app) => {
|
|
55
35
|
// 安装 uview-plus
|