@tplc/business 0.2.73 → 0.2.74

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,14 @@
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.2.74](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.73...v0.2.74) (2025-01-06)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 加载更多 ([ae2ba8b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae2ba8b24334aa2f1bb82c6a702cc72bb16beee1))
11
+ * 新增types ([b4ceffd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b4ceffdb507c04888370ca4ca0a523d528429a49))
12
+
5
13
  ### [0.2.73](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.72...v0.2.73) (2025-01-06)
6
14
 
7
15
 
@@ -9,6 +9,8 @@
9
9
  :fixed="false"
10
10
  :use-page-scroll="false"
11
11
  :height="height"
12
+ @onRefresh="onRefresh"
13
+ :loading-more-enabled="!refreshed"
12
14
  >
13
15
  <slot />
14
16
  </z-paging>
@@ -30,11 +32,13 @@ defineOptions({
30
32
  styleIsolation: 'shared',
31
33
  },
32
34
  })
35
+ const emits = defineEmits(['refresh'])
33
36
  const props = defineProps<LcbFilterListProps>()
34
37
  const dataList = ref<unknown[]>([])
35
38
  const paging = ref()
36
39
  const height = useAutoHeight()
37
40
  const form = inject<Ref<Record<string, any>>>(FORM_KEY)
41
+ const refreshed = ref(false)
38
42
  useZPaging(paging)
39
43
  const modelValue = defineModel<unknown[]>({
40
44
  default: [],
@@ -82,6 +86,11 @@ const queryList = async (page: number, limit: number) => {
82
86
  } catch (error) {
83
87
  paging.value.complete(false)
84
88
  }
89
+ refreshed.value = false
90
+ }
91
+ const onRefresh = async () => {
92
+ refreshed.value = true
93
+ emits('refresh')
85
94
  }
86
95
  </script>
87
96
  <style lang="scss" scoped>
@@ -28,6 +28,7 @@
28
28
  v-bind="{ ...info.listInfo, listType, ...props }"
29
29
  :autoHeight="!isSticky"
30
30
  v-model="items"
31
+ @refresh="productRef?.clear?.()"
31
32
  v-if="mode === 'list'"
32
33
  >
33
34
  <slot name="list" :items="items" v-if="$slots.list" />
@@ -36,13 +37,20 @@
36
37
  v-bind="{ ...$props, ...attrs, form }"
37
38
  :items="items"
38
39
  filterList
40
+ ref="productRef"
39
41
  v-if="$slots.item"
40
42
  >
41
43
  <template #item="{ item }">
42
44
  <slot name="item" :item="item"></slot>
43
45
  </template>
44
46
  </lcb-product>
45
- <lcb-product v-bind="{ ...$props, ...attrs, form }" filterList :items="items" v-else />
47
+ <lcb-product
48
+ v-bind="{ ...$props, ...attrs, form }"
49
+ filterList
50
+ :items="items"
51
+ ref="productRef"
52
+ v-else
53
+ />
46
54
  </template>
47
55
  </FilterList>
48
56
  <lcb-map v-else-if="mode === 'map'" v-bind="{ ...info.listInfo, ...$props, ...attrs }" />
@@ -61,6 +69,7 @@ const attrs = useAttrs()
61
69
  /** 是否悬停 */
62
70
  const sticky = ref(false)
63
71
  const items = ref([])
72
+ const productRef = ref()
64
73
  defineOptions({
65
74
  name: 'LcbList',
66
75
  options: {
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, useAttrs, watch, computed } from 'vue'
2
+ import { ref, useAttrs, watch, computed, watchEffect } from 'vue'
3
3
  import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
4
4
  import ULazyLoad from 'uview-plus/components/u-lazy-load/u-lazy-load.vue'
5
5
  import { LcbProductProps } from './types'
@@ -17,20 +17,25 @@ defineOptions({
17
17
  },
18
18
  })
19
19
  const attrs = useAttrs()
20
- const list = ref<Record<string, any>[]>([])
21
20
  const props = withDefaults(defineProps<LcbProductProps>(), {
22
21
  listType: 'list',
23
22
  imageWidth: 200,
24
23
  imageHeight: 250,
25
24
  titleLineClamp: 2,
26
25
  })
26
+ const renderList = ref<Record<string, any>[]>([])
27
+ watchEffect(() => {
28
+ if (!props.filterList) return
29
+ renderList.value = props.items as Record<string, any>[]
30
+ })
27
31
  defineSlots<{
28
32
  item(props: { item: any }): any
29
33
  }>()
30
34
  watch(
31
35
  () => props.form,
32
36
  () => {
33
- uWaterfallRef.value?.clear?.()
37
+ renderList.value = []
38
+ uWaterfallRef.value?.clear()
34
39
  },
35
40
  { deep: true },
36
41
  )
@@ -40,15 +45,19 @@ const getData = async () => {
40
45
  const { data } = await uni.$lcb.http.post('/productInfo/filteredPage', {
41
46
  productIdList: props.items.map((item) => item.productId),
42
47
  })
43
- list.value = data as Record<string, any>[]
48
+ renderList.value = data as Record<string, any>[]
44
49
  } else {
45
- list.value = []
50
+ renderList.value = []
46
51
  }
47
52
  }
48
53
 
49
54
  watch(() => props.items, getData, { immediate: true, deep: true })
50
- const renderList = computed(() => {
51
- return props.filterList ? props.items : list.value
55
+
56
+ defineExpose({
57
+ clear: () => {
58
+ renderList.value = []
59
+ uWaterfallRef.value?.clear()
60
+ },
52
61
  })
53
62
  </script>
54
63
 
@@ -87,7 +96,7 @@ const renderList = computed(() => {
87
96
  </lcb-action-view>
88
97
  </view>
89
98
  <!-- 双列 -->
90
- <view class="grid p-3 grid-cols-2 gap-2 box-border" v-if="listType === 'grid'">
99
+ <view class="grid p-3 grid-cols-2 gap-2 box-border" v-else-if="listType === 'grid'">
91
100
  <lcb-action-view
92
101
  v-for="(item, index) in renderList"
93
102
  :key="`${item?.productId}:${index}`"
@@ -120,8 +129,8 @@ const renderList = computed(() => {
120
129
  </lcb-action-view>
121
130
  </view>
122
131
 
123
- <view class="lcb-product-waterfall">
124
- <u-waterfall :modelValue="renderList" v-if="listType === 'waterfall'" ref="uWaterfallRef">
132
+ <view class="lcb-product-waterfall" v-else-if="listType === 'waterfall'">
133
+ <u-waterfall :modelValue="renderList" ref="uWaterfallRef">
125
134
  <template #left="{ leftList: list }">
126
135
  <view class="flex flex-col gap-3">
127
136
  <lcb-action-view
@@ -152,7 +161,6 @@ const renderList = computed(() => {
152
161
  threshold="-800"
153
162
  :border-radius="imageRadius"
154
163
  :image="value"
155
- :is-effect="false"
156
164
  :loading-img="getPreviewImageUrl(value)"
157
165
  :index="index"
158
166
  />
@@ -193,7 +201,6 @@ const renderList = computed(() => {
193
201
  :border-radius="imageRadius"
194
202
  :image="value"
195
203
  :index="index"
196
- :is-effect="false"
197
204
  :loading-img="getPreviewImageUrl(value)"
198
205
  />
199
206
  </template>
@@ -205,7 +212,7 @@ const renderList = computed(() => {
205
212
  </u-waterfall>
206
213
  </view>
207
214
 
208
- <scroll-view v-if="listType == 'horizontal'" scroll-x>
215
+ <scroll-view v-else-if="listType == 'horizontal'" scroll-x>
209
216
  <view class="p-3 whitespace-nowrap overflow-x-auto">
210
217
  <view
211
218
  v-for="(item, index) in renderList"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.73",
3
+ "version": "0.2.74",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -16,11 +16,13 @@ declare const __VLS_component: import('vue').DefineComponent<
16
16
  import('vue').ComponentOptionsMixin,
17
17
  {
18
18
  'update:modelValue': (modelValue: unknown[]) => void
19
+ refresh: (...args: any[]) => void
19
20
  },
20
21
  string,
21
22
  import('vue').PublicProps,
22
23
  Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
23
24
  'onUpdate:modelValue'?: ((modelValue: unknown[]) => any) | undefined
25
+ onRefresh?: ((...args: any[]) => any) | undefined
24
26
  },
25
27
  {},
26
28
  {}
@@ -14,7 +14,9 @@ declare const __VLS_component: import('vue').DefineComponent<
14
14
  titleLineClamp: number
15
15
  }
16
16
  >,
17
- {},
17
+ {
18
+ clear: () => void
19
+ },
18
20
  unknown,
19
21
  {},
20
22
  {},