uni-oaview 1.7.1 → 1.8.1
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/README.md +59 -0
- package/components/oa-page/oa-page.vue +8 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +13 -1
- package/package.json +1 -1
- package/src/composables/use-cookie-tempurl.ts +1 -1
- package/src/index.ts +25 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
## 目录
|
|
8
8
|
|
|
9
|
+
- [快速开始](#快速开始)
|
|
10
|
+
- [SDK 配置](#sdk-配置)
|
|
9
11
|
- [组件列表](#组件列表)
|
|
10
12
|
- [工具函数](#工具函数)
|
|
11
13
|
- [createModal - 函数式弹框](#createmodal---函数式弹框)
|
|
@@ -13,6 +15,63 @@
|
|
|
13
15
|
|
|
14
16
|
---
|
|
15
17
|
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
### 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install getui-oa-oaview-sdk-uniapp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 引入
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// main.ts
|
|
30
|
+
import { createSSRApp } from 'vue';
|
|
31
|
+
import App from './App.vue';
|
|
32
|
+
import OaView from 'getui-oa-oaview-sdk-uniapp';
|
|
33
|
+
|
|
34
|
+
export function createApp() {
|
|
35
|
+
const app = createSSRApp(App);
|
|
36
|
+
|
|
37
|
+
// 使用默认配置
|
|
38
|
+
app.use(OaView);
|
|
39
|
+
|
|
40
|
+
return { app };
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## SDK 配置
|
|
47
|
+
|
|
48
|
+
在 `app.use()` 时可传入配置对象自定义 SDK 行为:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
app.use(OaView, {
|
|
52
|
+
// 自定义 vconsole 白名单
|
|
53
|
+
whiteUrls: ['http://localhost:3000', 'http://192.168.1.100:8080'],
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### whiteUrls
|
|
58
|
+
|
|
59
|
+
配置 vconsole 调试工具自动显示的白名单 URL。
|
|
60
|
+
|
|
61
|
+
**类型**: `string[]`
|
|
62
|
+
|
|
63
|
+
**默认值**:
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
['http://192.168.11.231:6174', 'http://192.168.10.11:6174', 'http://dev-oa.ge.cn:6174', 'http://test-oa.ge.cn:6174'];
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**说明**: 当应用运行在白名单内的 URL 时,`oa-page` 组件会自动显示 vconsole 调试工具。传入空数组 `[]` 可禁用自动显示。
|
|
70
|
+
|
|
71
|
+
更多配置详情请参考 [SDK 配置文档](../../docs/zh/sdk-configuration.md)。
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
16
75
|
## 组件列表
|
|
17
76
|
|
|
18
77
|
| 组件名 | 说明 | 位置 |
|
|
@@ -7,20 +7,26 @@
|
|
|
7
7
|
<global-components ref="globalComponentsRef" />
|
|
8
8
|
</template>
|
|
9
9
|
<script lang="ts" setup>
|
|
10
|
-
import { ref } from 'vue';
|
|
10
|
+
import { ref, inject } from 'vue';
|
|
11
11
|
import { onBackPress } from '@dcloudio/uni-app';
|
|
12
12
|
import OaVconsole from '../oa-vconsole/oa-vconsole.vue';
|
|
13
13
|
import NetworkError from './nextwork-error.vue';
|
|
14
14
|
import GlobalComponents from './global-components.vue';
|
|
15
|
+
import { OA_VIEW_CONFIG_KEY } from '../../src/index';
|
|
15
16
|
|
|
16
17
|
const globalComponentsRef = ref<InstanceType<typeof GlobalComponents>>();
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
// 默认白名单(兜底值)
|
|
20
|
+
const defaultWhiteUrls = [
|
|
19
21
|
'http://192.168.11.231:6174',
|
|
20
22
|
'http://192.168.10.11:6174',
|
|
21
23
|
'http://dev-oa.ge.cn:6174',
|
|
22
24
|
'http://test-oa.ge.cn:6174',
|
|
23
25
|
];
|
|
26
|
+
|
|
27
|
+
// 注入配置,未配置时使用默认
|
|
28
|
+
const config = inject(OA_VIEW_CONFIG_KEY, { whiteUrls: defaultWhiteUrls });
|
|
29
|
+
const whiteUrls = config.whiteUrls;
|
|
24
30
|
/** oa-page高度,使用的是安全高度,windowHeight不包含NavigationBar和TabBar的高度
|
|
25
31
|
* https://uniapp.dcloud.net.cn/api/system/info.html#safearea
|
|
26
32
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -319,6 +319,10 @@ declare function useCookieTempFileUrl(url: string): {
|
|
|
319
319
|
tempUrl: _mp_rt1_vue___Ref<string>;
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
+
interface OaViewOptions {
|
|
323
|
+
whiteUrls?: string[];
|
|
324
|
+
}
|
|
325
|
+
declare const OA_VIEW_CONFIG_KEY: unique symbol;
|
|
322
326
|
declare const plugin: Plugin;
|
|
323
327
|
/**
|
|
324
328
|
* 向客户端获取数据
|
|
@@ -329,4 +333,4 @@ declare const plugin: Plugin;
|
|
|
329
333
|
*/
|
|
330
334
|
declare function getDataByApp(eventName: string, params: Record<string, any>, immediate?: boolean): Promise<any>;
|
|
331
335
|
|
|
332
|
-
export { CreateModalReturn, Message, MessageBox, ModalBaseEvents, ModalCloseReason, ModalHeaderEvents, ModalHeaderOptions, ModalOptions, RouteMethodName, VersionCheckRuntimeOptions, VersionCheckRuntimeState, VersionCheckSource, VersionCheckTriggerContext, closeAllModals, compareVersions, createDebounceFn, createModal, createVersionCheckRuntime, plugin as default, getAppVersion, getDataByApp, getTempFilePathForCookie, isCurrentVersionHigher, sendLaunchAppParamsLog, useCookieTempFileUrl, versionCheckRuntime };
|
|
336
|
+
export { CreateModalReturn, Message, MessageBox, ModalBaseEvents, ModalCloseReason, ModalHeaderEvents, ModalHeaderOptions, ModalOptions, OA_VIEW_CONFIG_KEY, OaViewOptions, RouteMethodName, VersionCheckRuntimeOptions, VersionCheckRuntimeState, VersionCheckSource, VersionCheckTriggerContext, closeAllModals, compareVersions, createDebounceFn, createModal, createVersionCheckRuntime, plugin as default, getAppVersion, getDataByApp, getTempFilePathForCookie, isCurrentVersionHigher, sendLaunchAppParamsLog, useCookieTempFileUrl, versionCheckRuntime };
|
package/dist/index.esm.js
CHANGED
|
@@ -3908,7 +3908,19 @@ function useCookieTempFileUrl(url) {
|
|
|
3908
3908
|
};
|
|
3909
3909
|
}
|
|
3910
3910
|
|
|
3911
|
+
// 默认白名单
|
|
3912
|
+
var defaultWhiteUrls = ['http://192.168.11.231:6174', 'http://192.168.10.11:6174', 'http://dev-oa.ge.cn:6174', 'http://test-oa.ge.cn:6174'];
|
|
3913
|
+
// 配置注入 key
|
|
3914
|
+
var OA_VIEW_CONFIG_KEY = Symbol('oa-view-config');
|
|
3911
3915
|
var install = function install(app) {
|
|
3916
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3917
|
+
var _a;
|
|
3918
|
+
// 合并配置
|
|
3919
|
+
var config = {
|
|
3920
|
+
whiteUrls: (_a = options.whiteUrls) !== null && _a !== void 0 ? _a : defaultWhiteUrls
|
|
3921
|
+
};
|
|
3922
|
+
// 全局 provide 配置
|
|
3923
|
+
app.provide(OA_VIEW_CONFIG_KEY, config);
|
|
3912
3924
|
app.mixin({
|
|
3913
3925
|
onLaunch: function onLaunch(params) {
|
|
3914
3926
|
sendLaunchAppParamsLog(params);
|
|
@@ -3948,4 +3960,4 @@ function getDataByApp(eventName, params) {
|
|
|
3948
3960
|
});
|
|
3949
3961
|
}
|
|
3950
3962
|
|
|
3951
|
-
export { Message, MessageBox, closeAllModals, compareVersions, createDebounceFn, createModal, createVersionCheckRuntime, plugin as default, getAppVersion, getDataByApp, getTempFilePathForCookie, isCurrentVersionHigher, sendLaunchAppParamsLog, useCookieTempFileUrl, versionCheckRuntime };
|
|
3963
|
+
export { Message, MessageBox, OA_VIEW_CONFIG_KEY, closeAllModals, compareVersions, createDebounceFn, createModal, createVersionCheckRuntime, plugin as default, getAppVersion, getDataByApp, getTempFilePathForCookie, isCurrentVersionHigher, sendLaunchAppParamsLog, useCookieTempFileUrl, versionCheckRuntime };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,7 +4,31 @@ import { sendLaunchAppParamsLog } from './utils';
|
|
|
4
4
|
export * from './utils';
|
|
5
5
|
export * from './composables';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// SDK 配置接口
|
|
8
|
+
export interface OaViewOptions {
|
|
9
|
+
whiteUrls?: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 默认白名单
|
|
13
|
+
const defaultWhiteUrls = [
|
|
14
|
+
'http://192.168.11.231:6174',
|
|
15
|
+
'http://192.168.10.11:6174',
|
|
16
|
+
'http://dev-oa.ge.cn:6174',
|
|
17
|
+
'http://test-oa.ge.cn:6174',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// 配置注入 key
|
|
21
|
+
export const OA_VIEW_CONFIG_KEY = Symbol('oa-view-config');
|
|
22
|
+
|
|
23
|
+
const install = (app: App, options: OaViewOptions = {}) => {
|
|
24
|
+
// 合并配置
|
|
25
|
+
const config = {
|
|
26
|
+
whiteUrls: options.whiteUrls ?? defaultWhiteUrls,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 全局 provide 配置
|
|
30
|
+
app.provide(OA_VIEW_CONFIG_KEY, config);
|
|
31
|
+
|
|
8
32
|
app.mixin({
|
|
9
33
|
onLaunch(params: any) {
|
|
10
34
|
sendLaunchAppParamsLog(params);
|