@tplc/business 0.0.41 → 0.0.47
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 +52 -0
- package/action.d.ts +3 -0
- package/components/lcb-action-view/lcb-action-view.vue +19 -4
- package/components/lcb-dynamic-data/lcb-dynamic-data.vue +5 -2
- package/components/lcb-dynamic-data/types.ts +1 -1
- package/components/lcb-list/components/FilterList/index.vue +1 -5
- package/components/lcb-list/index.scss +5 -0
- package/components/lcb-list/lcb-list.vue +23 -2
- package/components/lcb-list/types.ts +1 -1
- package/components/lcb-nav/lcb-nav.vue +1 -1
- package/components/lcb-product/lcb-product.vue +56 -11
- package/components/lcb-product-item/components/ItemValue.vue +77 -65
- package/components/lcb-product-item/lcb-product-item.vue +69 -15
- package/components/lcb-product-item/types.ts +14 -0
- package/components/lcb-user-top/api/index.ts +13 -0
- package/components/lcb-user-top/lcb-user-top.vue +43 -41
- package/components/lcb-user-top/types.ts +4 -47
- package/constants.ts +2 -0
- package/hooks/useUpload.api.ts +17 -0
- package/hooks/useUpload.ts +111 -0
- package/package.json +2 -2
- package/types/components/lcb-action-view/lcb-action-view.vue.d.ts +22 -2
- package/types/components/lcb-dynamic-data/types.d.ts +1 -1
- package/types/components/lcb-list/components/FilterList/index.vue.d.ts +13 -1
- package/types/components/lcb-list/lcb-list.vue.d.ts +31 -1
- package/types/components/lcb-nav/lcb-nav.vue.d.ts +1 -1
- package/types/components/lcb-product/lcb-product.vue.d.ts +35 -1
- package/types/components/lcb-product-item/components/ItemValue.vue.d.ts +19 -1
- package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +36 -2
- package/types/components/lcb-product-item/types.d.ts +13 -0
- package/types/components/lcb-user-top/api/index.d.ts +10 -0
- package/types/components/lcb-user-top/lcb-user-top.vue.d.ts +3 -0
- package/types/components/lcb-user-top/types.d.ts +4 -3
- package/types/constants.d.ts +2 -0
- package/types/hooks/useUpload.api.d.ts +12 -0
- package/types/hooks/useUpload.d.ts +23 -0
- package/utils/utils.ts +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,58 @@
|
|
|
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.0.47](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.46...v0.0.47) (2024-10-26)
|
|
6
|
+
|
|
7
|
+
### [0.0.46](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.45...v0.0.46) (2024-10-26)
|
|
8
|
+
|
|
9
|
+
### [0.0.45](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.44...v0.0.45) (2024-10-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### ✨ Features | 新功能
|
|
13
|
+
|
|
14
|
+
* lcb list 增加插槽 ([abd3cb8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/abd3cb857b38055e77cff2e838603e44f1d01857))
|
|
15
|
+
* 动态数据 ([25cb0bf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/25cb0bff0d13f0640a254696e0550e4e14f08ede))
|
|
16
|
+
* 增加 lcb-list 插槽 ([ec1832a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ec1832a5478ed133485036c095b9fb97f61b9611))
|
|
17
|
+
* 暂时提交userTOP ([64a9895](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/64a98951e63cf78c799b88ce1f73e9905e93bf3d))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
21
|
+
|
|
22
|
+
* **release:** 0.0.43 ([1e53dca](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1e53dca714a73f575cee6af8730aad0dfd7c7bdd))
|
|
23
|
+
* **release:** 0.0.44 ([b849321](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b8493214ad99d7f4efcea00a878b2e25d857c2ec))
|
|
24
|
+
* 去除影响 windows 环境依赖安装的依赖项 ([75d42b5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/75d42b52f766ec7d8291f005d8e1c8e34162bd3e))
|
|
25
|
+
|
|
26
|
+
### [0.0.43](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.44...v0.0.43) (2024-10-26)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
30
|
+
|
|
31
|
+
* 去除影响 windows 环境依赖安装的依赖项 ([75d42b5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/75d42b52f766ec7d8291f005d8e1c8e34162bd3e))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### ✨ Features | 新功能
|
|
35
|
+
|
|
36
|
+
* lcb list 增加插槽 ([abd3cb8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/abd3cb857b38055e77cff2e838603e44f1d01857))
|
|
37
|
+
* 动态数据 ([25cb0bf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/25cb0bff0d13f0640a254696e0550e4e14f08ede))
|
|
38
|
+
* 增加 lcb-list 插槽 ([ec1832a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ec1832a5478ed133485036c095b9fb97f61b9611))
|
|
39
|
+
* 暂时提交userTOP ([64a9895](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/64a98951e63cf78c799b88ce1f73e9905e93bf3d))
|
|
40
|
+
|
|
41
|
+
### [0.0.44](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.43...v0.0.44) (2024-10-25)
|
|
42
|
+
|
|
43
|
+
### [0.0.43](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.20...v0.0.43) (2024-10-25)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
47
|
+
|
|
48
|
+
* gap 支持safe ([c4ba91d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c4ba91d452a1caccb4651cff1cf28b9899fa3eb0))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### ✨ Features | 新功能
|
|
52
|
+
|
|
53
|
+
* list box-shadow ([e086e39](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e086e394074a507d840a062e91e3949d7aa11ffe))
|
|
54
|
+
|
|
55
|
+
### [0.0.42](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.41...v0.0.42) (2024-10-25)
|
|
56
|
+
|
|
5
57
|
### [0.0.41](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.40...v0.0.41) (2024-10-25)
|
|
6
58
|
|
|
7
59
|
|
package/action.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
class="lcb-action-btn"
|
|
5
5
|
:open-type="openType"
|
|
6
6
|
@getphonenumber="getPhoneNumber"
|
|
7
|
+
@chooseavatar="onChooseAvatar"
|
|
7
8
|
:class="customClass"
|
|
8
9
|
>
|
|
9
10
|
<slot />
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
<script setup lang="ts">
|
|
14
15
|
import { computed } from 'vue'
|
|
15
16
|
import { LcbActionViewProps } from './types'
|
|
17
|
+
import { uploadFile } from '../../hooks/useUpload'
|
|
16
18
|
defineOptions({
|
|
17
19
|
name: 'LcbActionView',
|
|
18
20
|
options: {
|
|
@@ -22,8 +24,13 @@ defineOptions({
|
|
|
22
24
|
},
|
|
23
25
|
})
|
|
24
26
|
const props = defineProps<LcbActionViewProps>()
|
|
27
|
+
const emits = defineEmits<{
|
|
28
|
+
(e: 'phone', value: { detail: { errMsg: string; encryptedData: string; iv: string } }): void
|
|
29
|
+
(e: 'avatar', value: string): void
|
|
30
|
+
}>()
|
|
31
|
+
|
|
25
32
|
const openType = computed(() => {
|
|
26
|
-
return { 88: 'getPhoneNumber', 12: 'contact' }[props.jumpType || '']
|
|
33
|
+
return { 88: 'getPhoneNumber', 12: 'contact', 101: 'chooseAvatar' }[props.jumpType || '']
|
|
27
34
|
})
|
|
28
35
|
const onActionClick = () => {
|
|
29
36
|
const { jumpAppid, jumpUrl: url, jumpType, phoneNumber } = props
|
|
@@ -123,11 +130,19 @@ const onActionClick = () => {
|
|
|
123
130
|
}
|
|
124
131
|
const getPhoneNumber = (e) => {
|
|
125
132
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
|
126
|
-
|
|
127
|
-
console.log('encryptedData:', e.detail.encryptedData)
|
|
128
|
-
console.log('iv:', e.detail.iv)
|
|
133
|
+
emits('phone', e)
|
|
129
134
|
}
|
|
130
135
|
}
|
|
136
|
+
const onChooseAvatar = async (e) => {
|
|
137
|
+
const url = e.detail.avatarUrl
|
|
138
|
+
uploadFile({
|
|
139
|
+
filePath: url,
|
|
140
|
+
name: url.split('/').pop(),
|
|
141
|
+
onSuccess: (e) => {
|
|
142
|
+
emits('avatar', e)
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
}
|
|
131
146
|
</script>
|
|
132
147
|
|
|
133
148
|
<style lang="scss" scoped>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<lcb-block v-bind="$props">
|
|
3
|
-
<view class="flex">
|
|
3
|
+
<view class="flex justify-between items-center">
|
|
4
4
|
<view v-for="item in items" :key="item.title">
|
|
5
|
-
<view>{{ item.unit }} {{ item.key }}</view>
|
|
5
|
+
<view>{{ item.unit }} {{ pageInfo[item.key] }}</view>
|
|
6
6
|
<view>{{ item.title }}</view>
|
|
7
7
|
</view>
|
|
8
8
|
</view>
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
|
+
import { PAGE_PROVIDE_KEY } from '../../constants'
|
|
14
|
+
import { inject } from 'vue'
|
|
13
15
|
import { LcbDynamicDataProps } from './types'
|
|
14
16
|
defineOptions({
|
|
15
17
|
name: 'LcbDynamicData',
|
|
@@ -19,6 +21,7 @@ defineOptions({
|
|
|
19
21
|
styleIsolation: 'shared',
|
|
20
22
|
},
|
|
21
23
|
})
|
|
24
|
+
const pageInfo = inject(PAGE_PROVIDE_KEY, {})
|
|
22
25
|
withDefaults(defineProps<LcbDynamicDataProps>(), {})
|
|
23
26
|
</script>
|
|
24
27
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:class="{
|
|
6
6
|
'lcb-filter__border-top': showPlain ? false : border,
|
|
7
7
|
'lcb-filter__plain': showPlain,
|
|
8
|
-
'
|
|
8
|
+
'lcb-filter__view': !showPlain,
|
|
9
9
|
}"
|
|
10
10
|
class="w-100vw"
|
|
11
11
|
>
|
|
@@ -68,7 +68,24 @@
|
|
|
68
68
|
</view>
|
|
69
69
|
</wd-sticky>
|
|
70
70
|
|
|
71
|
-
<FilterList v-bind="{ ...info.listInfo, listType, filter, ...attrs }"
|
|
71
|
+
<FilterList v-bind="{ ...info.listInfo, listType, filter, ...attrs }">
|
|
72
|
+
<template #default="{ items }">
|
|
73
|
+
<slot name="list" :items="items">
|
|
74
|
+
<lcb-product v-bind="{ ...attrs }" :listType="listType" :items="items">
|
|
75
|
+
<template #item="slotContext">
|
|
76
|
+
<slot name="item" v-bind="slotContext" />
|
|
77
|
+
</template>
|
|
78
|
+
<template
|
|
79
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
80
|
+
:key="slotName"
|
|
81
|
+
#[slotName]="slotContext"
|
|
82
|
+
>
|
|
83
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
84
|
+
</template>
|
|
85
|
+
</lcb-product>
|
|
86
|
+
</slot>
|
|
87
|
+
</template>
|
|
88
|
+
</FilterList>
|
|
72
89
|
</view>
|
|
73
90
|
</template>
|
|
74
91
|
|
|
@@ -82,10 +99,14 @@ import ComponentGroup from './components/ComponentGroup/index.vue'
|
|
|
82
99
|
import TagSelect from './components/TagSelect/index.vue'
|
|
83
100
|
import FilterList from './components/FilterList/index.vue'
|
|
84
101
|
import FilterTabs from './components/FilterTabs/index.vue'
|
|
102
|
+
import { lcbProductItemContentTypes } from '../lcb-product-item/types'
|
|
103
|
+
|
|
85
104
|
import './index.scss'
|
|
86
105
|
import { FORM_KEY } from '../../constants'
|
|
87
106
|
const attrs = useAttrs()
|
|
88
107
|
|
|
108
|
+
const slotNames = [...lcbProductItemContentTypes, 'item']
|
|
109
|
+
|
|
89
110
|
defineOptions({
|
|
90
111
|
name: 'LcbList',
|
|
91
112
|
options: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from 'vue'
|
|
3
3
|
import { LcbProductProps } from './types'
|
|
4
|
+
import { lcbProductItemContentTypes } from '../lcb-product-item/types'
|
|
5
|
+
|
|
4
6
|
const attrs = useAttrs()
|
|
5
7
|
defineOptions({
|
|
6
8
|
name: 'LcbProduct',
|
|
@@ -17,16 +19,39 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
|
17
19
|
imageHeightPercent: (300 / 560) * 100,
|
|
18
20
|
itemHeight: 560,
|
|
19
21
|
} as any)
|
|
22
|
+
defineSlots<{
|
|
23
|
+
image(): any
|
|
24
|
+
title(): any
|
|
25
|
+
subTitle(): any
|
|
26
|
+
price(): any
|
|
27
|
+
priceUnit(): any
|
|
28
|
+
priceSuffix(): any
|
|
29
|
+
originPrice(): any
|
|
30
|
+
originPriceUnit(): any
|
|
31
|
+
tags(): any
|
|
32
|
+
location(): any
|
|
33
|
+
distance(): any
|
|
34
|
+
}>()
|
|
20
35
|
</script>
|
|
21
36
|
|
|
22
37
|
<template>
|
|
23
38
|
<lcb-block v-bind="$props">
|
|
24
39
|
<view class="flex flex-col gap-2 p-2" v-if="listType === 'list'">
|
|
25
40
|
<view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
<slot name="item" :item="item">
|
|
42
|
+
<lcb-product-item
|
|
43
|
+
v-bind="{ ...item, ...attrs }"
|
|
44
|
+
:imageStyle="{ width: `${imageWidthPercent}%` }"
|
|
45
|
+
>
|
|
46
|
+
<template
|
|
47
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
48
|
+
:key="slotName"
|
|
49
|
+
#[slotName]="slotContext"
|
|
50
|
+
>
|
|
51
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
52
|
+
</template>
|
|
53
|
+
</lcb-product-item>
|
|
54
|
+
</slot>
|
|
30
55
|
</view>
|
|
31
56
|
</view>
|
|
32
57
|
|
|
@@ -34,12 +59,22 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
|
34
59
|
<view v-for="(item, index) in items" :key="`${item?.productId}:${index}`" class="w-1/2">
|
|
35
60
|
<view class="p-1 overflow-hidden">
|
|
36
61
|
<view class="rounded overflow-hidden" :style="{ height: `${itemHeight}rpx` }">
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
<slot name="item" :item="item">
|
|
63
|
+
<lcb-product-item
|
|
64
|
+
v-bind="{ ...item, ...attrs }"
|
|
65
|
+
layoutType="vertical"
|
|
66
|
+
className="!h-full"
|
|
67
|
+
:imageStyle="{ height: `${imageHeightPercent}%` }"
|
|
68
|
+
>
|
|
69
|
+
<template
|
|
70
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
71
|
+
:key="slotName"
|
|
72
|
+
#[slotName]="slotContext"
|
|
73
|
+
>
|
|
74
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
75
|
+
</template>
|
|
76
|
+
</lcb-product-item>
|
|
77
|
+
</slot>
|
|
43
78
|
</view>
|
|
44
79
|
</view>
|
|
45
80
|
</view>
|
|
@@ -52,7 +87,17 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
|
52
87
|
:key="`${item?.productId}:${index}`"
|
|
53
88
|
class="!w-66vw flex-shrink-0"
|
|
54
89
|
>
|
|
55
|
-
<
|
|
90
|
+
<slot name="item" :item="item">
|
|
91
|
+
<lcb-product-item v-bind="item" imageClass="!w-1/2">
|
|
92
|
+
<template
|
|
93
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
94
|
+
:key="slotName"
|
|
95
|
+
#[slotName]="slotContext"
|
|
96
|
+
>
|
|
97
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
98
|
+
</template>
|
|
99
|
+
</lcb-product-item>
|
|
100
|
+
</slot>
|
|
56
101
|
</view>
|
|
57
102
|
</view>
|
|
58
103
|
</scroll-view>
|
|
@@ -14,6 +14,20 @@ const props = withDefaults(
|
|
|
14
14
|
{},
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
+
// defineSlots<{
|
|
18
|
+
// image(): any
|
|
19
|
+
// title(): any
|
|
20
|
+
// subTitle(): any
|
|
21
|
+
// price(): any
|
|
22
|
+
// priceUnit(): any
|
|
23
|
+
// priceSuffix(): any
|
|
24
|
+
// originPrice(): any
|
|
25
|
+
// originPriceUnit(): any
|
|
26
|
+
// tags(): any
|
|
27
|
+
// location(): any
|
|
28
|
+
// distance(): any
|
|
29
|
+
// }>()
|
|
30
|
+
|
|
17
31
|
const visible = computed(() => {
|
|
18
32
|
return itemProps?.[`${props?.prop}Visible`] ?? true
|
|
19
33
|
})
|
|
@@ -31,85 +45,83 @@ const value = computed(() => {
|
|
|
31
45
|
<template>
|
|
32
46
|
<template v-if="visible && !!value && (isArray(value) ? value?.length > 0 : true)">
|
|
33
47
|
<!-- 图片 -->
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
48
|
+
<slot :value="value" v-if="prop === 'image'" name="image">
|
|
49
|
+
<view :value="value" :class="className" :style="style">
|
|
50
|
+
<image :src="value" class="w-full h-full" mode="aspectFill" />
|
|
51
|
+
</view>
|
|
52
|
+
</slot>
|
|
37
53
|
|
|
38
54
|
<!-- 标题 -->
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class="text-ellipsis line-clamp-2"
|
|
45
|
-
>
|
|
46
|
-
<view>{{ value }}</view>
|
|
47
|
-
</view>
|
|
55
|
+
<slot :value="value" v-if="prop === 'title'" name="title">
|
|
56
|
+
<view :class="className" :style="style" :value="value" class="text-ellipsis line-clamp-1">
|
|
57
|
+
<view>{{ value }}</view>
|
|
58
|
+
</view>
|
|
59
|
+
</slot>
|
|
48
60
|
|
|
49
61
|
<!-- 位置 -->
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
<slot :value="value" v-if="prop === 'location'" name="location">
|
|
63
|
+
<view
|
|
64
|
+
:class="className"
|
|
65
|
+
:style="style"
|
|
66
|
+
:value="value"
|
|
67
|
+
class="text-gray-500 text-22rpx flex gap-3rpx items-center"
|
|
68
|
+
>
|
|
69
|
+
<wd-icon name="location" size="32rpx"></wd-icon>
|
|
70
|
+
<view>{{ value }}</view>
|
|
71
|
+
</view>
|
|
72
|
+
</slot>
|
|
60
73
|
|
|
61
74
|
<!-- 标签 -->
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
:style="style"
|
|
65
|
-
v-if="prop === 'tags'"
|
|
66
|
-
:value="value"
|
|
67
|
-
class="flex gap-1 whitespace-nowrap overflow-auto"
|
|
68
|
-
>
|
|
69
|
-
<wd-tag
|
|
70
|
-
v-for="tag in value"
|
|
71
|
-
:key="tag"
|
|
72
|
-
class="!text-20rpx"
|
|
75
|
+
<slot :value="value" v-if="prop === 'tags'" name="tags">
|
|
76
|
+
<view
|
|
73
77
|
:class="className"
|
|
74
78
|
:style="style"
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
:value="value"
|
|
80
|
+
class="flex gap-1 whitespace-nowrap overflow-auto"
|
|
77
81
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
<wd-tag
|
|
83
|
+
v-for="tag in value"
|
|
84
|
+
:key="tag"
|
|
85
|
+
class="!text-20rpx"
|
|
86
|
+
:class="className"
|
|
87
|
+
:style="style"
|
|
88
|
+
plain
|
|
89
|
+
type="primary"
|
|
90
|
+
>
|
|
91
|
+
{{ tag }}
|
|
92
|
+
</wd-tag>
|
|
93
|
+
</view>
|
|
94
|
+
</slot>
|
|
81
95
|
|
|
82
96
|
<!-- 价格单位 -->
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
<slot :value="value" v-if="prop === 'priceUnit'" name="priceUnit">
|
|
98
|
+
<view
|
|
99
|
+
:class="className"
|
|
100
|
+
:style="style"
|
|
101
|
+
:value="value"
|
|
102
|
+
class="text-red-500 font-bold text-22rpx"
|
|
103
|
+
>
|
|
104
|
+
<view>{{ value }}</view>
|
|
105
|
+
</view>
|
|
106
|
+
</slot>
|
|
92
107
|
|
|
93
108
|
<!-- 价格 -->
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
<slot :value="value" v-if="prop === 'price'" name="price">
|
|
110
|
+
<view
|
|
111
|
+
:class="className"
|
|
112
|
+
:style="style"
|
|
113
|
+
:value="value"
|
|
114
|
+
class="text-red-500 font-bold text-27rpx"
|
|
115
|
+
>
|
|
116
|
+
<view>{{ value }}</view>
|
|
117
|
+
</view>
|
|
118
|
+
</slot>
|
|
103
119
|
|
|
104
120
|
<!-- 价格后缀 -->
|
|
105
|
-
<
|
|
106
|
-
:class="className"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class="text-22rpx"
|
|
111
|
-
>
|
|
112
|
-
<view>{{ value }}</view>
|
|
113
|
-
</view>
|
|
121
|
+
<slot :value="value" v-if="prop === 'priceSuffix'" name="priceSuffix">
|
|
122
|
+
<view :class="className" :style="style" :value="value" class="text-22rpx">
|
|
123
|
+
<view>{{ value }}</view>
|
|
124
|
+
</view>
|
|
125
|
+
</slot>
|
|
114
126
|
</template>
|
|
115
127
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, provide, useAttrs } from 'vue'
|
|
3
|
-
import { LcbProductItemProps } from './types'
|
|
3
|
+
import { lcbProductItemContentTypes, LcbProductItemProps } from './types'
|
|
4
4
|
import ItemValue from './components/ItemValue.vue'
|
|
5
5
|
|
|
6
6
|
defineOptions({
|
|
@@ -32,25 +32,59 @@ const attrs = useAttrs()
|
|
|
32
32
|
|
|
33
33
|
provide('lcb-product-item-props', props)
|
|
34
34
|
|
|
35
|
+
defineSlots<{
|
|
36
|
+
image(): any
|
|
37
|
+
title(): any
|
|
38
|
+
subTitle(): any
|
|
39
|
+
price(): any
|
|
40
|
+
priceUnit(): any
|
|
41
|
+
priceSuffix(): any
|
|
42
|
+
originPrice(): any
|
|
43
|
+
originPriceUnit(): any
|
|
44
|
+
tags(): any
|
|
45
|
+
location(): any
|
|
46
|
+
distance(): any
|
|
47
|
+
}>()
|
|
48
|
+
|
|
35
49
|
// console.log('attrs', attrs)
|
|
36
50
|
</script>
|
|
37
51
|
|
|
38
52
|
<template>
|
|
39
53
|
<!-- 横向布局 -->
|
|
40
54
|
<view v-if="layoutType === 'horizontal'" :class="className" class="flex gap-3 px-2 py-3 bg-white">
|
|
41
|
-
<ItemValue prop="image" className="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden"
|
|
55
|
+
<ItemValue prop="image" className="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden">
|
|
56
|
+
<template
|
|
57
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
58
|
+
:key="slotName"
|
|
59
|
+
#[slotName]="slotContext"
|
|
60
|
+
>
|
|
61
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
62
|
+
</template>
|
|
63
|
+
</ItemValue>
|
|
42
64
|
<view class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden">
|
|
43
65
|
<view class="flex flex-col gap-2 overflow-hidden">
|
|
44
|
-
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop"
|
|
66
|
+
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop">
|
|
67
|
+
<template
|
|
68
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
69
|
+
:key="slotName"
|
|
70
|
+
#[slotName]="slotContext"
|
|
71
|
+
>
|
|
72
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
73
|
+
</template>
|
|
74
|
+
</ItemValue>
|
|
45
75
|
</view>
|
|
46
76
|
|
|
47
77
|
<view class="flex gap-2">
|
|
48
78
|
<view class="flex gap-[4rpx] items-end">
|
|
49
|
-
<ItemValue
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
<ItemValue v-for="prop in ['priceUnit', 'price', 'priceSuffix']" :prop="prop" :key="prop">
|
|
80
|
+
<template
|
|
81
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
82
|
+
:key="slotName"
|
|
83
|
+
#[slotName]="slotContext"
|
|
84
|
+
>
|
|
85
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
86
|
+
</template>
|
|
87
|
+
</ItemValue>
|
|
54
88
|
</view>
|
|
55
89
|
</view>
|
|
56
90
|
</view>
|
|
@@ -58,23 +92,43 @@ provide('lcb-product-item-props', props)
|
|
|
58
92
|
|
|
59
93
|
<!-- 竖向布局 -->
|
|
60
94
|
<view v-if="layoutType === 'vertical'" :class="className" class="flex flex-col gap-2 bg-white">
|
|
61
|
-
<ItemValue prop="image" className="overflow-hidden"
|
|
95
|
+
<ItemValue prop="image" className="overflow-hidden">
|
|
96
|
+
<template
|
|
97
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
98
|
+
:key="slotName"
|
|
99
|
+
#[slotName]="slotContext"
|
|
100
|
+
>
|
|
101
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
102
|
+
</template>
|
|
103
|
+
</ItemValue>
|
|
62
104
|
<view
|
|
63
105
|
:class="'p-2'"
|
|
64
106
|
class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden"
|
|
65
107
|
>
|
|
66
108
|
<view class="flex flex-col gap-2 overflow-hidden">
|
|
67
109
|
<!-- <ItemValue prop="title"></ItemValue> -->
|
|
68
|
-
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop"
|
|
110
|
+
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop">
|
|
111
|
+
<template
|
|
112
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
113
|
+
:key="slotName"
|
|
114
|
+
#[slotName]="slotContext"
|
|
115
|
+
>
|
|
116
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
117
|
+
</template>
|
|
118
|
+
</ItemValue>
|
|
69
119
|
</view>
|
|
70
120
|
|
|
71
121
|
<view class="flex gap-2">
|
|
72
122
|
<view class="flex gap-[4rpx] items-end">
|
|
73
|
-
<ItemValue
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
123
|
+
<ItemValue v-for="prop in ['priceUnit', 'price', 'priceSuffix']" :prop="prop" :key="prop">
|
|
124
|
+
<template
|
|
125
|
+
v-for="slotName in lcbProductItemContentTypes"
|
|
126
|
+
:key="slotName"
|
|
127
|
+
#[slotName]="slotContext"
|
|
128
|
+
>
|
|
129
|
+
<slot :name="slotName" v-bind="slotContext" />
|
|
130
|
+
</template>
|
|
131
|
+
</ItemValue>
|
|
78
132
|
</view>
|
|
79
133
|
</view>
|
|
80
134
|
</view>
|