uni-oaview 1.0.24 → 1.0.26

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.
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <view class="network-error" v-if="isNetworkError">
2
+ <view class="network-error" v-if="networkErrorInfo">
3
3
  <image style="width: 13px; height: 13px" src="../../imgs/warn.svg" />
4
- <span style="margin-left: 5px; line-height: 10px">网络错误,请检查本地连接</span>
4
+ <span style="margin-left: 5px; line-height: 10px">{{ networkErrorInfo }}</span>
5
5
  </view>
6
6
  </template>
7
7
 
8
8
  <script lang="ts" setup>
9
9
  import { ref } from 'vue';
10
- const isNetworkError = ref(false);
10
+ const networkErrorInfo = ref();
11
11
  /** 监听网络状态 */
12
- uni.onNativeEventReceive(function (event: string, data: boolean) {
13
- if (event === 'networkStatus') {
14
- isNetworkError.value = !data;
12
+ uni.onNativeEventReceive(function (event: string, data: string) {
13
+ if (event === 'networkStatusInfo') {
14
+ networkErrorInfo.value = data;
15
15
  }
16
16
  });
17
17
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <oa-vconsole v-if="showLog" />
3
- <view class="oa-page" @click="clickHandler">
3
+ <view class="oa-page" :style="{ height: windowHeight }" @click="clickHandler">
4
4
  <NetworkError />
5
5
  <slot />
6
6
  </view>
@@ -15,6 +15,10 @@
15
15
  'http://dev-oa.ge.cn:6174',
16
16
  'http://test-oa.ge.cn:6174',
17
17
  ];
18
+ /** oa-page高度,使用的是安全高度,windowHeight不包含NavigationBar和TabBar的高度
19
+ * https://uniapp.dcloud.net.cn/api/system/info.html#safearea
20
+ */
21
+ const windowHeight = uni.getSystemInfoSync()?.windowHeight ?? 'auto';
18
22
  const baseUrl = uni.getStorageSync('baseUrl');
19
23
  /** 如果在debug状态,或者是在白名单里面,则展示vconsole */
20
24
  const showLog = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
@@ -21,8 +21,8 @@
21
21
  </view>
22
22
  </template>
23
23
  <script lang="ts" setup>
24
- import { createDebounceFn } from '../../src/index';
25
24
  import { ref, nextTick, watch, watchEffect } from 'vue';
25
+ import { useDebounceFn } from '@vueuse/core';
26
26
  const props = defineProps<{
27
27
  title?: string;
28
28
  value?: string;
@@ -47,7 +47,7 @@
47
47
  indexList.value = [index];
48
48
  };
49
49
  init();
50
- const bindChange = createDebounceFn((e: any) => {
50
+ const bindChange = useDebounceFn((e: any) => {
51
51
  const val = e.detail.value;
52
52
  nextTick(() => {
53
53
  indexList.value = val;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,7 @@
1
- /**
2
- * 上报APP启动小程序的时候的入参
3
- * @param params
4
- */
5
- declare function sendLaunchAppParamsLog(params: any): void;
6
-
7
- /**
8
- * 防抖函数
9
- * @param callback
10
- * @param time
11
- * @returns
12
- */
13
- declare function createDebounceFn(callback: (...params: any[]) => void, time: number): (...params: any[]) => void;
1
+ import { App } from 'vue';
14
2
 
15
3
  declare const _default: {
16
- install: (Vue: any) => void;
4
+ install: (app: App<Element>, options: any) => void;
17
5
  };
18
6
 
19
- export { createDebounceFn, _default as default, sendLaunchAppParamsLog };
7
+ export { _default as default };
package/dist/index.umd.js CHANGED
@@ -10,6 +10,7 @@
10
10
  */
11
11
  function sendLaunchAppParamsLog(params) {
12
12
  var _a;
13
+ console.log('小程序启动入参:', params);
13
14
  // #ifndef H5
14
15
  try {
15
16
  var outputData = JSON.parse(JSON.stringify((_a = params === null || params === void 0 ? void 0 : params.referrerInfo) === null || _a === void 0 ? void 0 : _a.extraData));
@@ -21,33 +22,18 @@
21
22
  // #endif
22
23
  }
23
24
 
24
- /**
25
- * 防抖函数
26
- * @param callback
27
- * @param time
28
- * @returns
29
- */
30
- function createDebounceFn(callback, time) {
31
- var timer = null;
32
- return function () {
33
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
34
- params[_key] = arguments[_key];
25
+ var install = function install(app, options) {
26
+ app.mixin({
27
+ onLaunch: function onLaunch(params) {
28
+ sendLaunchAppParamsLog(params);
35
29
  }
36
- clearTimeout(timer);
37
- timer = setTimeout(function () {
38
- callback.apply(void 0, params);
39
- }, time);
40
- };
41
- }
42
-
43
- var install = function install(Vue) {};
30
+ });
31
+ };
44
32
  var index = {
45
33
  install: install
46
34
  };
47
35
 
48
- exports.createDebounceFn = createDebounceFn;
49
36
  exports["default"] = index;
50
- exports.sendLaunchAppParamsLog = sendLaunchAppParamsLog;
51
37
 
52
38
  Object.defineProperty(exports, '__esModule', { value: true });
53
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,6 +1,14 @@
1
- export * from './utils';
1
+ import { App } from 'vue';
2
2
 
3
- const install = (Vue: any) => {};
3
+ import { sendLaunchAppParamsLog } from './utils';
4
+
5
+ const install = (app: App<Element>, options: any) => {
6
+ app.mixin({
7
+ onLaunch(params: any) {
8
+ sendLaunchAppParamsLog(params);
9
+ },
10
+ });
11
+ };
4
12
 
5
13
  export default {
6
14
  install,
@@ -5,6 +5,7 @@ import { reportLog } from 'uniapp-log-sdk';
5
5
  * @param params
6
6
  */
7
7
  export function sendLaunchAppParamsLog(params: any) {
8
+ console.log('小程序启动入参:', params);
8
9
  // #ifndef H5
9
10
  try {
10
11
  const outputData = JSON.parse(JSON.stringify(params?.referrerInfo?.extraData));