im-ui-mobile 0.0.69 → 0.0.70
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 +23 -21
- package/package.json +1 -1
- package/types/index.d.ts +3 -8
package/index.js
CHANGED
|
@@ -39,29 +39,33 @@ for (const key in importFn) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// 全局配置对象
|
|
42
|
-
let
|
|
42
|
+
let config = {}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// 默认配置
|
|
45
|
+
const defaultConfig = {
|
|
46
|
+
emojiUrl: '',
|
|
47
|
+
baseURL: ''
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const install = (app, options = {}) => {
|
|
51
|
+
// 合并配置
|
|
52
|
+
config = { ...defaultConfig, ...options }
|
|
47
53
|
|
|
48
54
|
// // 配置 Emoji
|
|
49
55
|
// if (globalConfig.emojiUrl) {
|
|
50
56
|
// emoji.setEmojiUrl(globalConfig.emojiUrl);
|
|
51
57
|
// }
|
|
52
58
|
|
|
53
|
-
// 配置
|
|
54
|
-
if (upuiParams) {
|
|
55
|
-
uni.upuiParams = upuiParams
|
|
56
|
-
const temp = upuiParams()
|
|
57
|
-
if (temp.options) {
|
|
58
|
-
setConfig(temp.options)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
59
|
|
|
62
60
|
// 提供全局配置
|
|
63
61
|
app.provide('im-config', options.config || {})
|
|
64
62
|
|
|
63
|
+
// 应用配置到各个模块
|
|
64
|
+
if (config.emojiUrl) {
|
|
65
|
+
// 初始化 emoji 模块
|
|
66
|
+
emoji.setEmojiUrl(config.emojiUrl);
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
// 安装插件
|
|
66
70
|
|
|
67
71
|
// // 安装pinia插件
|
|
@@ -78,18 +82,16 @@ const install = (app, upuiParams = '') => {
|
|
|
78
82
|
})
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
// 导出安装函数和配置方法
|
|
82
|
-
const setConfig = (options) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
85
|
+
// // 导出安装函数和配置方法
|
|
86
|
+
// const setConfig = (options) => {
|
|
87
|
+
// if (options.emoji && options.emoji.baseUrl) {
|
|
88
|
+
// emoji.setEmojiUrl(options.emoji.baseUrl);
|
|
89
|
+
// }
|
|
90
|
+
// };
|
|
88
91
|
|
|
89
|
-
const getConfig = () => ({ ...
|
|
92
|
+
const getConfig = () => ({ ...config });
|
|
90
93
|
|
|
91
94
|
export {
|
|
92
|
-
setConfig,
|
|
93
95
|
getConfig,
|
|
94
96
|
eventBus,
|
|
95
97
|
datetime,
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -42,18 +42,13 @@ import type {
|
|
|
42
42
|
declare module 'im-ui-mobile' {
|
|
43
43
|
export function install(): void
|
|
44
44
|
|
|
45
|
-
interface
|
|
46
|
-
|
|
45
|
+
interface Config {
|
|
46
|
+
emojiUrl: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
emoji: Partial<EmojiConfig>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function setConfig(config: Partial<GlobalConfig>): void;
|
|
49
|
+
export function getConfig(): Config;
|
|
54
50
|
|
|
55
51
|
export {
|
|
56
|
-
ImUiConfig,
|
|
57
52
|
eventBus,
|
|
58
53
|
datetime,
|
|
59
54
|
Emoji,
|