@tplc/business 0.5.5 → 0.5.6

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,8 @@
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.6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.5...v0.5.6) (2025-10-10)
6
+
5
7
  ### [0.5.5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.4...v0.5.5) (2025-10-10)
6
8
 
7
9
  ### [0.5.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.3...v0.5.4) (2025-10-10)
@@ -20,7 +20,7 @@
20
20
  <script setup lang="ts">
21
21
  import { ref, watch } from 'vue'
22
22
  import { AddressCommunityProps } from '../types'
23
- import useLocation from '../../../hooks/useLocation'
23
+ import useLocation, { useCurrentAddressId } from '../../../hooks/useLocation'
24
24
 
25
25
  defineOptions({
26
26
  name: 'AddressCommunity',
@@ -35,15 +35,14 @@ withDefaults(defineProps<AddressCommunityProps>(), {
35
35
  color: '#000',
36
36
  width: 240,
37
37
  })
38
- const { userLocation, userAddressId } = useLocation()
38
+ const { userLocation } = useLocation()
39
39
  const value = defineModel<string>('')
40
40
  const title = ref<string>('地址社区')
41
41
  const options = ref<{ addressName: string; addressId: string }[]>([])
42
42
 
43
43
  const handleChange = (e: any) => {
44
44
  title.value = e.selectedItem.label
45
- userAddressId.value = e.selectedItem.addressId
46
- uni.$emit('lcb-city-select-change', e.selectedItem)
45
+ useCurrentAddressId().value = e.selectedItem.addressId
47
46
  }
48
47
  watch(
49
48
  () => userLocation.value,
@@ -55,8 +54,7 @@ watch(
55
54
  const firstItem = data[0]
56
55
  title.value = firstItem.label
57
56
  value.value = firstItem.addressId
58
- userAddressId.value = firstItem.addressId
59
- uni.$emit('lcb-city-select-change', firstItem)
57
+ useCurrentAddressId().value = firstItem.addressId
60
58
  }
61
59
  }
62
60
  },
@@ -64,13 +62,6 @@ watch(
64
62
  immediate: true,
65
63
  },
66
64
  )
67
-
68
- watch(
69
- () => userAddressId.value,
70
- (val) => {
71
- console.log('userAddressId', val)
72
- },
73
- )
74
65
  </script>
75
66
 
76
67
  <style lang="scss" scoped>
@@ -2,8 +2,9 @@ import { useTranslate } from '@tplc/wot'
2
2
  import { ref } from 'vue'
3
3
  import { getUserLocation, UserLocation } from './useLocation.api'
4
4
  export const currentLocation = ref<UserLocation>()
5
- export const currentAddressId = ref<string>('')
5
+ const currentAddressId = ref<string>('')
6
6
  export const currentUserLatLon = ref<UniApp.GetLocationSuccess>()
7
+ export const useCurrentAddressId = () => currentAddressId
7
8
  const useLocation = (onLocation?: (location: UserLocation) => void) => {
8
9
  const { translate } = useTranslate()
9
10
  // 正在获取经纬度
@@ -65,10 +66,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
65
66
  userLatitude: res.latitude.toString(),
66
67
  })
67
68
  .then((res) => {
68
- currentLocation.value = {
69
- ...currentLocation.value,
70
- ...res.data,
71
- }
69
+ currentLocation.value = res.data
72
70
  if (force) onLocation?.(res.data)
73
71
  })
74
72
  .finally(() => {
@@ -80,10 +78,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
80
78
  console.log('获取位置信息失败:', res)
81
79
  getUserLocation()
82
80
  .then((res) => {
83
- currentLocation.value = {
84
- ...currentLocation.value,
85
- ...res.data,
86
- }
81
+ currentLocation.value = res.data
87
82
  })
88
83
  .finally(() => {
89
84
  locationIng.value = false
@@ -101,7 +96,6 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
101
96
  locationIng,
102
97
  userLocation: currentLocation,
103
98
  userLatLon: currentUserLatLon,
104
- userAddressId: currentAddressId,
105
99
  }
106
100
  }
107
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -1,12 +1,11 @@
1
1
  import { UserLocation } from './useLocation.api'
2
2
  export declare const currentLocation: import('vue').Ref<UserLocation | undefined>
3
- export declare const currentAddressId: import('vue').Ref<string>
4
3
  export declare const currentUserLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
4
+ export declare const useCurrentAddressId: () => import('vue').Ref<string>
5
5
  declare const useLocation: (onLocation?: (location: UserLocation) => void) => {
6
6
  getLocation: (force?: boolean, forceSetting?: boolean) => Promise<void>
7
7
  locationIng: import('vue').Ref<boolean>
8
8
  userLocation: import('vue').Ref<UserLocation | undefined>
9
9
  userLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
10
- userAddressId: import('vue').Ref<string>
11
10
  }
12
11
  export default useLocation