@tplc/business 0.5.57 → 0.5.59

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.59](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.58...v0.5.59) (2025-12-02)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 默认offsetTop ([23f7924](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/23f79247cc494a99a0c97a7354b5449c9a24f925))
11
+
12
+ ### [0.5.58](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.57...v0.5.58) (2025-12-02)
13
+
5
14
  ### [0.5.57](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.56...v0.5.57) (2025-12-02)
6
15
 
7
16
 
@@ -205,10 +205,9 @@ const onActionClick = async () => {
205
205
  if (url) {
206
206
  const windowInfo = uni.getWindowInfo()
207
207
  const navbarHeight = (windowInfo.statusBarHeight || 0) + 44
208
- onPageScrollSelector(
209
- url,
210
- 'offsetTopNavbar' in props && props.offsetTopNavbar ? navbarHeight : 0,
211
- )
208
+ const offsetTop =
209
+ 'offsetTopNavbar' in props && props.offsetTopNavbar !== false ? navbarHeight : 0
210
+ onPageScrollSelector(url, offsetTop)
212
211
  }
213
212
  break
214
213
  case 17:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.57",
3
+ "version": "0.5.59",
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
@@ -74,11 +75,21 @@ export const getFinalUrl = (url: string, urlParams?: string) => {
74
75
  }
75
76
 
76
77
  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,
81
- })
78
+ const prefix = (uni.$lcb.layoutId ? `#${uni.$lcb.layoutId} >>> #` : '#') + selector
79
+ uni
80
+ .createSelectorQuery()
81
+ .in(getCurrentInstance()?.proxy)
82
+ .select(prefix)
83
+ .boundingClientRect()
84
+ .exec((res) => {
85
+ console.log(res)
86
+ if (res && res[0]) {
87
+ uni.pageScrollTo({
88
+ // selector: `${prefix}${selector}`,
89
+ scrollTop: res[0].top + offsetTop,
90
+ })
91
+ }
92
+ })
82
93
  }
83
94
 
84
95
  export const getPreviewImageUrl = (url: string, width = 200) => {