im-ui-mobile 0.0.39 → 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 +28 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { UViewPlusPlugin } from './plugins/uview-plus.js'
|
|
2
|
-
import ImChat from './components/im-
|
|
2
|
+
// import ImChat from './components/im-sample/im-sample.vue'
|
|
3
3
|
|
|
4
4
|
// 重要:为组件添加名称,以支持开发环境
|
|
5
|
-
ImChat.name = 'ImChat'
|
|
5
|
+
// ImChat.name = 'ImChat'
|
|
6
6
|
|
|
7
|
-
const components = [
|
|
8
|
-
|
|
9
|
-
]
|
|
7
|
+
// const components = [
|
|
8
|
+
// ImChat
|
|
9
|
+
// ]
|
|
10
|
+
|
|
11
|
+
const importFn = import.meta.glob('./components/im-*/im-*.vue', { eager: true })
|
|
12
|
+
const components = [];
|
|
13
|
+
|
|
14
|
+
for (const key in importFn) {
|
|
15
|
+
const component = importFn[key].default;
|
|
16
|
+
|
|
17
|
+
// 1. 从文件路径中提取组件名(更可靠的方法)
|
|
18
|
+
const fileName = key.split('/').pop(); // 获取文件名,如 im-button.vue
|
|
19
|
+
const componentName = fileName
|
|
20
|
+
.replace('.vue', '') // 去掉 .vue 后缀
|
|
21
|
+
.replace(/\b\w/g, l => l.toUpperCase()) // 首字母大写,如 ImButton
|
|
22
|
+
|
|
23
|
+
// 2. 添加到组件列表
|
|
24
|
+
if (component) {
|
|
25
|
+
// 如果组件本身没有 name,给它设置一个
|
|
26
|
+
if (!component.name) {
|
|
27
|
+
component.name = componentName;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
components.push(component);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
10
33
|
|
|
11
34
|
const install = (app) => {
|
|
12
35
|
// 安装 uview-plus
|