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 CHANGED
@@ -39,29 +39,33 @@ for (const key in importFn) {
39
39
  }
40
40
 
41
41
  // 全局配置对象
42
- let globalConfig = {};
42
+ let config = {}
43
43
 
44
- const install = (app, upuiParams = '') => {
45
- // // 合并配置
46
- // globalConfig = { ...globalConfig, ...options };
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
- Object.assign(globalConfig, options);
84
- if (options.emoji && options.emoji.baseUrl) {
85
- emoji.setEmojiUrl(options.emoji.baseUrl);
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 = () => ({ ...globalConfig });
92
+ const getConfig = () => ({ ...config });
90
93
 
91
94
  export {
92
- setConfig,
93
95
  getConfig,
94
96
  eventBus,
95
97
  datetime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "im-ui-mobile",
3
- "version": "0.0.69",
3
+ "version": "0.0.70",
4
4
  "description": "A Vue3.0 + typescript instant messaging component library for Uniapp",
5
5
  "type": "module",
6
6
  "main": "index.js",
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 EmojiConfig {
46
- baseUrl: string;
45
+ interface Config {
46
+ emojiUrl: string;
47
47
  }
48
48
 
49
- interface GlobalConfig {
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,