@tplc/business 0.5.58 → 0.5.60

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.5.60](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.59...v0.5.60) (2025-12-02)
6
+
7
+ ### [0.5.59](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.58...v0.5.59) (2025-12-02)
8
+
9
+
10
+ ### ✨ Features | 新功能
11
+
12
+ * 默认offsetTop ([23f7924](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/23f79247cc494a99a0c97a7354b5449c9a24f925))
13
+
5
14
  ### [0.5.58](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.57...v0.5.58) (2025-12-02)
6
15
 
7
16
  ### [0.5.57](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.56...v0.5.57) (2025-12-02)
@@ -204,10 +204,10 @@ const onActionClick = async () => {
204
204
  case 16:
205
205
  if (url) {
206
206
  const windowInfo = uni.getWindowInfo()
207
- const navbarHeight = (windowInfo.statusBarHeight || 0) + 44
207
+ const navbarHeight = (windowInfo.statusBarHeight || 0) + 44 + 24
208
208
  const offsetTop =
209
209
  'offsetTopNavbar' in props && props.offsetTopNavbar !== false ? navbarHeight : 0
210
- onPageScrollSelector(url, offsetTop ? navbarHeight : 0)
210
+ onPageScrollSelector(url, offsetTop)
211
211
  }
212
212
  break
213
213
  case 17:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.58",
3
+ "version": "0.5.60",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
package/utils/utils.ts CHANGED
@@ -4,6 +4,7 @@ import { uploadFile } from '../hooks/useUpload'
4
4
  import { parse, stringify } from 'qs'
5
5
  import { get } from 'lodash-es'
6
6
  import { transformValueUnit } from './transform'
7
+ import { getCurrentInstance } from 'vue'
7
8
  export function formatJson(str: string | object | undefined, defVal = {}) {
8
9
  if (!str) return defVal
9
10
  if (typeof str === 'object') return str
@@ -73,11 +74,23 @@ export const getFinalUrl = (url: string, urlParams?: string) => {
73
74
  })}`
74
75
  }
75
76
 
76
- export const onPageScrollSelector = (selector: string, offsetTop?: number) => {
77
- const prefix = uni.$lcb.layoutId ? `#${uni.$lcb.layoutId} >>> #` : '#'
78
- uni.pageScrollTo({
79
- selector: `${prefix}${selector}`,
80
- offsetTop,
77
+ export const onPageScrollSelector = (selector: string, offsetTop = 0) => {
78
+ const prefix = (uni.$lcb.layoutId ? `#${uni.$lcb.layoutId} >>> #` : '#') + selector
79
+ const query = uni.createSelectorQuery().in(getCurrentInstance()?.proxy)
80
+ // @ts-ignore
81
+ query.selectViewport().scrollOffset()
82
+ query.select(prefix).boundingClientRect()
83
+ query.exec((res) => {
84
+ const scrollRes = res[0]
85
+ const rect = res[1]
86
+ const currentScrollTop = scrollRes?.scrollTop || 0
87
+ if (rect) {
88
+ const absoluteTop = rect.top + currentScrollTop
89
+ const adjustedScrollTop = absoluteTop - offsetTop
90
+ uni.pageScrollTo({
91
+ scrollTop: adjustedScrollTop,
92
+ })
93
+ }
81
94
  })
82
95
  }
83
96