@tplc/business 0.0.38 → 0.0.40
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 +17 -0
- package/components/lcb-list/api.ts +1 -1
- package/components/lcb-list/components/FilterList/index.vue +16 -9
- package/components/lcb-list/components/FilterList/type.ts +2 -0
- package/components/lcb-list/lcb-list.vue +8 -15
- package/components/lcb-list/types.ts +16 -0
- package/components/lcb-nav/lcb-nav.vue +7 -1
- package/components/lcb-product/lcb-product.vue +49 -36
- package/components/lcb-product/types.ts +5 -11
- package/components/lcb-product-item/components/ItemValue.vue +115 -0
- package/components/lcb-product-item/lcb-product-item.vue +50 -27
- package/components/lcb-product-item/types.ts +43 -3
- package/package.json +1 -1
- package/types/components/lcb-list/components/FilterList/type.d.ts +2 -0
- package/types/components/lcb-list/lcb-list.vue.d.ts +5 -30
- package/types/components/lcb-list/types.d.ts +4 -0
- package/types/components/lcb-product/lcb-product.vue.d.ts +11 -3
- package/types/components/lcb-product/types.d.ts +5 -11
- package/types/components/lcb-product-item/components/ItemValue.vue.d.ts +55 -0
- package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +36 -6
- package/types/components/lcb-product-item/types.d.ts +39 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.40](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.39...v0.0.40) (2024-10-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 增加 list 组件可配置性 ([8f3bc26](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/8f3bc267f965cd74e66ab714f0713440a9d64451))
|
|
11
|
+
* 消除 product-item reuse 代码 ([32eee08](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/32eee089a360c4d8c32207eaee083f5f1646e7c5))
|
|
12
|
+
|
|
13
|
+
### [0.0.39](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.38...v0.0.39) (2024-10-23)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ✨ Features | 新功能
|
|
17
|
+
|
|
18
|
+
* 优化 lcb-list 相关逻辑 ([c81aeb8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c81aeb8e0f9b3b5931f6c227133e2b7a314fa089))
|
|
19
|
+
* 优化 product-item 实现 ([40ad6c6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/40ad6c6ee4beb15a66210771b2e32972484a0341))
|
|
20
|
+
* 修改返回按钮尺寸 ([7c946aa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7c946aa3cd4c9d02b663044618eededa8542ba8b))
|
|
21
|
+
|
|
5
22
|
### [0.0.38](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.17...v0.0.38) (2024-10-22)
|
|
6
23
|
|
|
7
24
|
|
|
@@ -7,15 +7,20 @@
|
|
|
7
7
|
@query="queryList"
|
|
8
8
|
use-page-scroll
|
|
9
9
|
>
|
|
10
|
-
<lcb-product
|
|
10
|
+
<lcb-product
|
|
11
|
+
v-bind="{ ...productProps, ...attrs }"
|
|
12
|
+
:listType="listType"
|
|
13
|
+
:items="normalizeDataList"
|
|
14
|
+
/>
|
|
11
15
|
</z-paging>
|
|
12
16
|
</template>
|
|
13
17
|
|
|
14
18
|
<script setup lang="ts">
|
|
15
|
-
import { computed, ref, watch } from 'vue'
|
|
19
|
+
import { computed, ref, watch, useAttrs } from 'vue'
|
|
16
20
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
|
|
17
21
|
import { LcbFilterListProps } from './type'
|
|
18
22
|
import { formatJson } from '../../../../utils/utils'
|
|
23
|
+
const attrs = useAttrs()
|
|
19
24
|
|
|
20
25
|
defineOptions({
|
|
21
26
|
name: 'FilterList',
|
|
@@ -40,9 +45,11 @@ const normalizeDataList = computed(() => {
|
|
|
40
45
|
title: item?.productName,
|
|
41
46
|
tags,
|
|
42
47
|
price: item?.price,
|
|
48
|
+
location: item?.cityAreaName,
|
|
49
|
+
priceSuffix: item?.behindUnit,
|
|
43
50
|
}
|
|
44
51
|
})
|
|
45
|
-
console.log('list', list)
|
|
52
|
+
// console.log('list', list)
|
|
46
53
|
|
|
47
54
|
return list
|
|
48
55
|
})
|
|
@@ -87,12 +94,12 @@ const queryList = async (page: number, limit: number) => {
|
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
watch(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)
|
|
97
|
+
// watch(
|
|
98
|
+
// () => dataList.value,
|
|
99
|
+
// () => {
|
|
100
|
+
// console.log('dataList', dataList.value)
|
|
101
|
+
// },
|
|
102
|
+
// )
|
|
96
103
|
</script>
|
|
97
104
|
<style lang="scss" scoped>
|
|
98
105
|
.action-view {
|
|
@@ -2,8 +2,10 @@ import { LcbListInfo } from '../../api'
|
|
|
2
2
|
import { LcbProductProps } from '../../../lcb-product/types'
|
|
3
3
|
export interface PageListProps {
|
|
4
4
|
emptyImage?: string
|
|
5
|
+
listType?: LcbProductProps['listType']
|
|
5
6
|
productProps?: LcbProductProps
|
|
6
7
|
}
|
|
7
8
|
export interface LcbFilterListProps extends PageListProps, LcbListInfo {
|
|
8
9
|
filter?: Record<string, any>
|
|
10
|
+
test?: any
|
|
9
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view v-if="info">
|
|
2
|
+
<view v-if="info" class="bg-gray-100">
|
|
3
3
|
<wd-sticky @sticky="sticky = $event" :offset-top="0.0001">
|
|
4
4
|
<view
|
|
5
5
|
:class="{
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
</view>
|
|
68
68
|
</wd-sticky>
|
|
69
69
|
|
|
70
|
-
<FilterList v-bind="{ ...info.listInfo,
|
|
70
|
+
<FilterList v-bind="{ ...info.listInfo, listType, filter, ...attrs }" test2="11" />
|
|
71
71
|
</view>
|
|
72
72
|
</template>
|
|
73
73
|
|
|
74
74
|
<script setup lang="ts">
|
|
75
|
-
import { computed, inject, Ref, ref, watch } from 'vue'
|
|
76
|
-
import { LcbListProps } from './types'
|
|
75
|
+
import { computed, inject, Ref, ref, watch, useAttrs } from 'vue'
|
|
76
|
+
import { LcbListProps, defaultLcbListProps } from './types'
|
|
77
77
|
import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
|
|
78
78
|
import FilterSelect from './components/FilterSelect/index.vue'
|
|
79
79
|
import TreeSelect from './components/TreeSelect/index.vue'
|
|
@@ -83,6 +83,8 @@ import FilterList from './components/FilterList/index.vue'
|
|
|
83
83
|
import FilterTabs from './components/FilterTabs/index.vue'
|
|
84
84
|
import './index.scss'
|
|
85
85
|
import { FORM_KEY } from '../../constants'
|
|
86
|
+
const attrs = useAttrs()
|
|
87
|
+
|
|
86
88
|
defineOptions({
|
|
87
89
|
name: 'LcbList',
|
|
88
90
|
options: {
|
|
@@ -93,23 +95,14 @@ defineOptions({
|
|
|
93
95
|
})
|
|
94
96
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
95
97
|
const dropMenu = ref()
|
|
96
|
-
const props = withDefaults(defineProps<LcbListProps>(),
|
|
97
|
-
pageFilterType: 'hotelTravelFilter',
|
|
98
|
-
border: true,
|
|
99
|
-
styleMode: 'default',
|
|
100
|
-
pageListProps: () => ({
|
|
101
|
-
productProps: {
|
|
102
|
-
styleGroup: 1,
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
})
|
|
98
|
+
const props = withDefaults(defineProps<LcbListProps>(), defaultLcbListProps as any)
|
|
106
99
|
const info = ref<LcbFilterResult>()
|
|
107
100
|
const filter = ref<Record<string, any>>({})
|
|
108
101
|
const titleObj = ref<Record<string, any>>({})
|
|
109
102
|
/** 是否悬停 */
|
|
110
103
|
const sticky = ref(false)
|
|
111
104
|
const showPlain = computed(() => {
|
|
112
|
-
console.log(props.styleMode, sticky.value, 'showPlain')
|
|
105
|
+
// console.log(props.styleMode, sticky.value, 'showPlain')
|
|
113
106
|
return props.styleMode === 'plain' && !sticky.value
|
|
114
107
|
})
|
|
115
108
|
watch(
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { PageListProps } from './components/FilterList/type'
|
|
2
|
+
import { LcbProductProps } from '../lcb-product/types'
|
|
2
3
|
|
|
3
4
|
export interface LcbListProps {
|
|
4
5
|
pageFilterType?: string
|
|
5
6
|
pageListProps?: PageListProps
|
|
6
7
|
border?: boolean
|
|
7
8
|
styleMode?: 'default' | 'plain'
|
|
9
|
+
listType?: LcbProductProps['listType']
|
|
8
10
|
}
|
|
9
11
|
export interface Option {
|
|
10
12
|
label: string
|
|
@@ -20,4 +22,18 @@ export interface FilterItemProps {
|
|
|
20
22
|
mode?: 'multiple' | 'single'
|
|
21
23
|
apiPath?: string
|
|
22
24
|
options?: Option[]
|
|
25
|
+
test?: 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const defaultLcbListProps: LcbListProps = {
|
|
29
|
+
pageFilterType: 'hotelTravelFilter',
|
|
30
|
+
border: true,
|
|
31
|
+
styleMode: 'default',
|
|
32
|
+
listType: 'grid',
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
pageListProps: () => ({
|
|
35
|
+
productProps: {
|
|
36
|
+
// listType: 'list',
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
23
39
|
}
|
|
@@ -47,7 +47,13 @@
|
|
|
47
47
|
</view>
|
|
48
48
|
</view>
|
|
49
49
|
<template v-else-if="back">
|
|
50
|
-
<wd-icon
|
|
50
|
+
<wd-icon
|
|
51
|
+
class-prefix="lcb"
|
|
52
|
+
name="zuo_left"
|
|
53
|
+
@click="toBack"
|
|
54
|
+
:color="contentColor"
|
|
55
|
+
size="44rpx"
|
|
56
|
+
/>
|
|
51
57
|
</template>
|
|
52
58
|
<view class="ml-2" v-if="titleLocation === 'left'">
|
|
53
59
|
<Search
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<lcb-block v-bind="$props">
|
|
3
|
-
<template v-if="styleGroup !== 2">
|
|
4
|
-
<view class="flex flex-col gap-2 p-2">
|
|
5
|
-
<view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
|
|
6
|
-
<!-- <view>{{ JSON.stringify(item) }}</view> -->
|
|
7
|
-
<lcb-product-item v-bind="item" />
|
|
8
|
-
</view>
|
|
9
|
-
</view>
|
|
10
|
-
</template>
|
|
11
|
-
<scroll-view v-if="styleGroup == 2" scroll-x class="w-full whitespace-nowrap">
|
|
12
|
-
<view class="flex shrink-0">
|
|
13
|
-
<view v-for="(item, index) in items" :key="index">
|
|
14
|
-
<lcb-product-item :styleProps="styleProps" :idx="index" v-bind="item" />
|
|
15
|
-
</view>
|
|
16
|
-
</view>
|
|
17
|
-
</scroll-view>
|
|
18
|
-
</lcb-block>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
1
|
<script setup lang="ts">
|
|
22
|
-
import { computed } from 'vue'
|
|
2
|
+
import { computed, useAttrs } from 'vue'
|
|
23
3
|
import { LcbProductProps } from './types'
|
|
4
|
+
const attrs = useAttrs()
|
|
24
5
|
defineOptions({
|
|
25
6
|
name: 'LcbProduct',
|
|
26
7
|
options: {
|
|
@@ -29,21 +10,53 @@ defineOptions({
|
|
|
29
10
|
styleIsolation: 'shared',
|
|
30
11
|
},
|
|
31
12
|
})
|
|
32
|
-
const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
showTags: props.showTags,
|
|
40
|
-
showPrice: props.showPrice,
|
|
41
|
-
showScribePrice: props.showScribePrice,
|
|
42
|
-
showCart: props.showCart,
|
|
43
|
-
showLocation: props.showLocation,
|
|
44
|
-
showCollection: props.showCollection,
|
|
45
|
-
}
|
|
46
|
-
})
|
|
13
|
+
const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
14
|
+
listType: 'list',
|
|
15
|
+
items: [],
|
|
16
|
+
imageWidthPercent: (1 / 3) * 100,
|
|
17
|
+
imageHeightPercent: (300 / 560) * 100,
|
|
18
|
+
itemHeight: 560,
|
|
19
|
+
} as any)
|
|
47
20
|
</script>
|
|
48
21
|
|
|
22
|
+
<template>
|
|
23
|
+
<lcb-block v-bind="$props">
|
|
24
|
+
<view class="flex flex-col gap-2 p-2" v-if="listType === 'list'">
|
|
25
|
+
<view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
|
|
26
|
+
<lcb-product-item
|
|
27
|
+
v-bind="{ ...item, ...attrs }"
|
|
28
|
+
:imageStyle="{ width: `${imageWidthPercent}%` }"
|
|
29
|
+
/>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
|
|
33
|
+
<view class="flex p-1 flex-wrap" v-if="listType === 'grid'">
|
|
34
|
+
<view v-for="(item, index) in items" :key="`${item?.productId}:${index}`" class="w-1/2">
|
|
35
|
+
<view class="p-1 overflow-hidden">
|
|
36
|
+
<view class="rounded overflow-hidden" :style="{ height: `${itemHeight}rpx` }">
|
|
37
|
+
<lcb-product-item
|
|
38
|
+
v-bind="{ ...item, ...attrs }"
|
|
39
|
+
layoutType="vertical"
|
|
40
|
+
className="!h-full"
|
|
41
|
+
:imageStyle="{ height: `${imageHeightPercent}%` }"
|
|
42
|
+
/>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
|
|
48
|
+
<scroll-view v-if="listType == 'horizontal'" scroll-x>
|
|
49
|
+
<view class="p-2 flex gap-2 whitespace-nowrap overflow-auto flex-nowrap">
|
|
50
|
+
<view
|
|
51
|
+
v-for="(item, index) in items"
|
|
52
|
+
:key="`${item?.productId}:${index}`"
|
|
53
|
+
class="!w-66vw flex-shrink-0"
|
|
54
|
+
>
|
|
55
|
+
<lcb-product-item v-bind="item" imageClass="!w-1/2" />
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
</scroll-view>
|
|
59
|
+
</lcb-block>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
49
62
|
<style lang="scss" scoped></style>
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
export interface LcbProductProps {
|
|
2
2
|
// Define the component's prop types here
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
showTags?: boolean
|
|
9
|
-
showPrice?: boolean
|
|
10
|
-
showScribePrice?: boolean
|
|
11
|
-
showCart?: boolean
|
|
12
|
-
showLocation?: boolean
|
|
13
|
-
showCollection?: boolean
|
|
3
|
+
listType?: 'list' | 'horizontal' | 'grid' | 'waterfall' // 1列表 2 左右滑动 3一行两个 4瀑布流
|
|
4
|
+
imageWidthPercent?: number
|
|
5
|
+
imageHeightPercent?: number
|
|
6
|
+
itemHeight?: number // 列表项高度
|
|
7
|
+
items?: Record<string, any>[]
|
|
14
8
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, computed, useAttrs } from 'vue'
|
|
3
|
+
import { isArray } from '@tplc/wot/components/common/util'
|
|
4
|
+
|
|
5
|
+
// const attrs = useAttrs()
|
|
6
|
+
|
|
7
|
+
const itemProps = inject('lcb-product-item-props')
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
prop: string
|
|
12
|
+
className?: string
|
|
13
|
+
}>(),
|
|
14
|
+
{},
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const visible = computed(() => {
|
|
18
|
+
return itemProps?.[`${props?.prop}Visible`] ?? true
|
|
19
|
+
})
|
|
20
|
+
const className = computed(() => {
|
|
21
|
+
return `${itemProps?.[`${props?.prop}Class`] ?? ''} ${props?.className}`
|
|
22
|
+
})
|
|
23
|
+
const style = computed(() => {
|
|
24
|
+
return itemProps?.[`${props?.prop}Style`] ?? ''
|
|
25
|
+
})
|
|
26
|
+
const value = computed(() => {
|
|
27
|
+
return itemProps?.[props?.prop]
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<template v-if="visible && !!value && (isArray(value) ? value?.length > 0 : true)">
|
|
33
|
+
<!-- 图片 -->
|
|
34
|
+
<view v-if="prop === 'image'" :value="value" :class="className" :style="style">
|
|
35
|
+
<image :src="value" class="w-full h-full" mode="aspectFill" />
|
|
36
|
+
</view>
|
|
37
|
+
|
|
38
|
+
<!-- 标题 -->
|
|
39
|
+
<view
|
|
40
|
+
v-if="prop === 'title'"
|
|
41
|
+
:class="className"
|
|
42
|
+
:style="style"
|
|
43
|
+
:value="value"
|
|
44
|
+
class="text-ellipsis line-clamp-2"
|
|
45
|
+
>
|
|
46
|
+
<view>{{ value }}</view>
|
|
47
|
+
</view>
|
|
48
|
+
|
|
49
|
+
<!-- 位置 -->
|
|
50
|
+
<view
|
|
51
|
+
:class="className"
|
|
52
|
+
:style="style"
|
|
53
|
+
v-if="prop === 'location'"
|
|
54
|
+
:value="value"
|
|
55
|
+
class="text-gray-500 text-22rpx flex gap-3rpx items-center"
|
|
56
|
+
>
|
|
57
|
+
<wd-icon name="location" size="32rpx"></wd-icon>
|
|
58
|
+
<view>{{ value }}</view>
|
|
59
|
+
</view>
|
|
60
|
+
|
|
61
|
+
<!-- 标签 -->
|
|
62
|
+
<view
|
|
63
|
+
:class="className"
|
|
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"
|
|
73
|
+
:class="className"
|
|
74
|
+
:style="style"
|
|
75
|
+
plain
|
|
76
|
+
type="primary"
|
|
77
|
+
>
|
|
78
|
+
{{ tag }}
|
|
79
|
+
</wd-tag>
|
|
80
|
+
</view>
|
|
81
|
+
|
|
82
|
+
<!-- 价格单位 -->
|
|
83
|
+
<view
|
|
84
|
+
:class="className"
|
|
85
|
+
:style="style"
|
|
86
|
+
v-if="prop === 'priceUnit'"
|
|
87
|
+
:value="value"
|
|
88
|
+
class="text-red-500 font-bold text-22rpx"
|
|
89
|
+
>
|
|
90
|
+
<view>{{ value }}</view>
|
|
91
|
+
</view>
|
|
92
|
+
|
|
93
|
+
<!-- 价格 -->
|
|
94
|
+
<view
|
|
95
|
+
:class="className"
|
|
96
|
+
:style="style"
|
|
97
|
+
v-if="prop === 'price'"
|
|
98
|
+
:value="value"
|
|
99
|
+
class="text-red-500 font-bold text-27rpx"
|
|
100
|
+
>
|
|
101
|
+
<view>{{ value }}</view>
|
|
102
|
+
</view>
|
|
103
|
+
|
|
104
|
+
<!-- 价格后缀 -->
|
|
105
|
+
<view
|
|
106
|
+
:class="className"
|
|
107
|
+
:style="style"
|
|
108
|
+
v-if="prop === 'priceSuffix'"
|
|
109
|
+
:value="value"
|
|
110
|
+
class="text-22rpx"
|
|
111
|
+
>
|
|
112
|
+
<view>{{ value }}</view>
|
|
113
|
+
</view>
|
|
114
|
+
</template>
|
|
115
|
+
</template>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useAttrs } from 'vue'
|
|
3
|
-
import { transformValueUnit } from '../../utils/transform'
|
|
2
|
+
import { computed, provide, useAttrs } from 'vue'
|
|
4
3
|
import { LcbProductItemProps } from './types'
|
|
5
|
-
import
|
|
4
|
+
import ItemValue from './components/ItemValue.vue'
|
|
6
5
|
|
|
7
6
|
defineOptions({
|
|
8
7
|
name: 'LcbProductItem',
|
|
@@ -14,48 +13,72 @@ defineOptions({
|
|
|
14
13
|
})
|
|
15
14
|
|
|
16
15
|
const props = withDefaults(defineProps<LcbProductItemProps>(), {
|
|
17
|
-
layoutType:
|
|
16
|
+
layoutType: 'horizontal',
|
|
18
17
|
priceUnit: '¥',
|
|
19
18
|
originPriceUnit: '¥',
|
|
20
|
-
|
|
19
|
+
imageVisible: true,
|
|
20
|
+
titleVisible: true,
|
|
21
|
+
subTitleVisible: true,
|
|
22
|
+
priceVisible: true,
|
|
23
|
+
priceUnitVisible: true,
|
|
24
|
+
priceSuffixVisible: true,
|
|
25
|
+
originPriceVisible: true,
|
|
26
|
+
originPriceUnitVisible: true,
|
|
27
|
+
tagsVisible: true,
|
|
28
|
+
locationVisible: true,
|
|
29
|
+
distanceVisible: true,
|
|
21
30
|
})
|
|
22
31
|
const attrs = useAttrs()
|
|
23
32
|
|
|
33
|
+
provide('lcb-product-item-props', props)
|
|
34
|
+
|
|
24
35
|
// console.log('attrs', attrs)
|
|
25
36
|
</script>
|
|
26
37
|
|
|
27
38
|
<template>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<view class="flex flex-col flex-1 justify-between text-26rpx overflow-hidden">
|
|
39
|
+
<!-- 横向布局 -->
|
|
40
|
+
<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" />
|
|
42
|
+
<view class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden">
|
|
33
43
|
<view class="flex flex-col gap-2 overflow-hidden">
|
|
34
|
-
<
|
|
35
|
-
<view v-if="tags?.length > 0" class="flex gap-1 whitespace-nowrap overflow-auto">
|
|
36
|
-
<wd-tag v-for="tag in tags" :key="tag" class="!text-20rpx" plain type="primary">
|
|
37
|
-
{{ tag }}
|
|
38
|
-
</wd-tag>
|
|
39
|
-
</view>
|
|
44
|
+
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop" />
|
|
40
45
|
</view>
|
|
46
|
+
|
|
41
47
|
<view class="flex gap-2">
|
|
42
|
-
<view class="flex gap-[
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
<view class="flex gap-[4rpx] items-end">
|
|
49
|
+
<ItemValue
|
|
50
|
+
v-for="prop in ['priceUnit', 'price', 'priceSuffix']"
|
|
51
|
+
:prop="prop"
|
|
52
|
+
:key="prop"
|
|
53
|
+
/>
|
|
46
54
|
</view>
|
|
47
55
|
</view>
|
|
48
56
|
</view>
|
|
49
57
|
</view>
|
|
50
58
|
|
|
51
|
-
<!--
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
<!-- 竖向布局 -->
|
|
60
|
+
<view v-if="layoutType === 'vertical'" :class="className" class="flex flex-col gap-2 bg-white">
|
|
61
|
+
<ItemValue prop="image" className="overflow-hidden" />
|
|
62
|
+
<view
|
|
63
|
+
:class="'p-2'"
|
|
64
|
+
class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden"
|
|
65
|
+
>
|
|
66
|
+
<view class="flex flex-col gap-2 overflow-hidden">
|
|
67
|
+
<!-- <ItemValue prop="title"></ItemValue> -->
|
|
68
|
+
<ItemValue v-for="prop in ['title', 'location', 'tags']" :prop="prop" :key="prop" />
|
|
69
|
+
</view>
|
|
70
|
+
|
|
71
|
+
<view class="flex gap-2">
|
|
72
|
+
<view class="flex gap-[4rpx] items-end">
|
|
73
|
+
<ItemValue
|
|
74
|
+
v-for="prop in ['priceUnit', 'price', 'priceSuffix']"
|
|
75
|
+
:prop="prop"
|
|
76
|
+
:key="prop"
|
|
77
|
+
/>
|
|
78
|
+
</view>
|
|
79
|
+
</view>
|
|
57
80
|
</view>
|
|
58
|
-
</view>
|
|
81
|
+
</view>
|
|
59
82
|
</template>
|
|
60
83
|
|
|
61
84
|
<style lang="scss" scoped></style>
|
|
@@ -1,16 +1,56 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue'
|
|
2
|
+
|
|
1
3
|
export interface LcbProductItemProps {
|
|
2
4
|
// Define the component's prop types here
|
|
3
|
-
|
|
5
|
+
className?: string
|
|
6
|
+
layoutType?: 'vertical' | 'horizontal'
|
|
4
7
|
image?: any
|
|
5
8
|
title?: any
|
|
6
9
|
subTitle?: any
|
|
7
10
|
price?: any
|
|
8
11
|
priceUnit?: any
|
|
12
|
+
priceSuffix?: any
|
|
9
13
|
originPrice?: any
|
|
10
14
|
originPriceUnit?: any
|
|
11
|
-
lowestPrice?: any
|
|
12
|
-
lowestPriceUnit?: any
|
|
13
15
|
tags?: any
|
|
14
16
|
location?: any
|
|
15
17
|
distance?: any
|
|
18
|
+
|
|
19
|
+
imageVisible?: boolean
|
|
20
|
+
titleVisible?: boolean
|
|
21
|
+
subTitleVisible?: boolean
|
|
22
|
+
priceVisible?: boolean
|
|
23
|
+
priceUnitVisible?: boolean
|
|
24
|
+
priceSuffixVisible?: boolean
|
|
25
|
+
originPriceVisible?: boolean
|
|
26
|
+
originPriceUnitVisible?: boolean
|
|
27
|
+
tagsVisible?: boolean
|
|
28
|
+
locationVisible?: boolean
|
|
29
|
+
distanceVisible?: boolean
|
|
30
|
+
|
|
31
|
+
imageClass?: string
|
|
32
|
+
titleClass?: string
|
|
33
|
+
subTitleClass?: string
|
|
34
|
+
priceClass?: string
|
|
35
|
+
priceUnitClass?: string
|
|
36
|
+
priceSuffixClass?: string
|
|
37
|
+
originPriceClass?: string
|
|
38
|
+
originPriceUnitClass?: string
|
|
39
|
+
tagsClass?: string
|
|
40
|
+
tagsWrapperClass?: string
|
|
41
|
+
locationClass?: string
|
|
42
|
+
distanceClass?: string
|
|
43
|
+
|
|
44
|
+
imageStyle?: CSSProperties
|
|
45
|
+
titleStyle?: CSSProperties
|
|
46
|
+
subTitleStyle?: CSSProperties
|
|
47
|
+
priceStyle?: CSSProperties
|
|
48
|
+
priceUnitStyle?: CSSProperties
|
|
49
|
+
priceSuffixStyle?: CSSProperties
|
|
50
|
+
originPriceStyle?: CSSProperties
|
|
51
|
+
originPriceUnitStyle?: CSSProperties
|
|
52
|
+
tagsStyle?: CSSProperties
|
|
53
|
+
tagsWrapperStyle?: CSSProperties
|
|
54
|
+
locationStyle?: CSSProperties
|
|
55
|
+
distanceStyle?: CSSProperties
|
|
16
56
|
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,10 @@ import { LcbListInfo } from '../../api'
|
|
|
2
2
|
import { LcbProductProps } from '../../../lcb-product/types'
|
|
3
3
|
export interface PageListProps {
|
|
4
4
|
emptyImage?: string
|
|
5
|
+
listType?: LcbProductProps['listType']
|
|
5
6
|
productProps?: LcbProductProps
|
|
6
7
|
}
|
|
7
8
|
export interface LcbFilterListProps extends PageListProps, LcbListInfo {
|
|
8
9
|
filter?: Record<string, any>
|
|
10
|
+
test?: any
|
|
9
11
|
}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { LcbListProps } from './types'
|
|
2
2
|
import './index.scss'
|
|
3
3
|
declare const _default: import('vue').DefineComponent<
|
|
4
|
-
__VLS_WithDefaults<
|
|
5
|
-
__VLS_TypePropsToOption<LcbListProps>,
|
|
6
|
-
{
|
|
7
|
-
pageFilterType: string
|
|
8
|
-
border: boolean
|
|
9
|
-
styleMode: string
|
|
10
|
-
pageListProps: () => {
|
|
11
|
-
productProps: {
|
|
12
|
-
styleGroup: number
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
>,
|
|
4
|
+
__VLS_WithDefaults<__VLS_TypePropsToOption<LcbListProps>, any>,
|
|
17
5
|
{},
|
|
18
6
|
unknown,
|
|
19
7
|
{},
|
|
@@ -24,27 +12,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
24
12
|
string,
|
|
25
13
|
import('vue').PublicProps,
|
|
26
14
|
Readonly<
|
|
27
|
-
import('vue').ExtractPropTypes<
|
|
28
|
-
__VLS_WithDefaults<
|
|
29
|
-
__VLS_TypePropsToOption<LcbListProps>,
|
|
30
|
-
{
|
|
31
|
-
pageFilterType: string
|
|
32
|
-
border: boolean
|
|
33
|
-
styleMode: string
|
|
34
|
-
pageListProps: () => {
|
|
35
|
-
productProps: {
|
|
36
|
-
styleGroup: number
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
>
|
|
41
|
-
>
|
|
15
|
+
import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LcbListProps>, any>>
|
|
42
16
|
>,
|
|
43
17
|
{
|
|
44
|
-
|
|
18
|
+
listType: 'horizontal' | 'list' | 'grid' | 'waterfall'
|
|
45
19
|
pageFilterType: string
|
|
46
|
-
|
|
20
|
+
border: boolean
|
|
47
21
|
styleMode: 'default' | 'plain'
|
|
22
|
+
pageListProps: import('./components/FilterList/type').PageListProps
|
|
48
23
|
},
|
|
49
24
|
{}
|
|
50
25
|
>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { PageListProps } from './components/FilterList/type'
|
|
2
|
+
import { LcbProductProps } from '../lcb-product/types'
|
|
2
3
|
export interface LcbListProps {
|
|
3
4
|
pageFilterType?: string
|
|
4
5
|
pageListProps?: PageListProps
|
|
5
6
|
border?: boolean
|
|
6
7
|
styleMode?: 'default' | 'plain'
|
|
8
|
+
listType?: LcbProductProps['listType']
|
|
7
9
|
}
|
|
8
10
|
export interface Option {
|
|
9
11
|
label: string
|
|
@@ -18,4 +20,6 @@ export interface FilterItemProps {
|
|
|
18
20
|
mode?: 'multiple' | 'single'
|
|
19
21
|
apiPath?: string
|
|
20
22
|
options?: Option[]
|
|
23
|
+
test?: 1
|
|
21
24
|
}
|
|
25
|
+
export declare const defaultLcbListProps: LcbListProps
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LcbProductProps } from './types'
|
|
2
2
|
declare const _default: import('vue').DefineComponent<
|
|
3
|
-
__VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>,
|
|
3
|
+
__VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>,
|
|
4
4
|
{},
|
|
5
5
|
unknown,
|
|
6
6
|
{},
|
|
@@ -11,9 +11,17 @@ declare const _default: import('vue').DefineComponent<
|
|
|
11
11
|
string,
|
|
12
12
|
import('vue').PublicProps,
|
|
13
13
|
Readonly<
|
|
14
|
-
import('vue').ExtractPropTypes<
|
|
14
|
+
import('vue').ExtractPropTypes<
|
|
15
|
+
__VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>
|
|
16
|
+
>
|
|
15
17
|
>,
|
|
16
|
-
{
|
|
18
|
+
{
|
|
19
|
+
items: Record<string, any>[]
|
|
20
|
+
listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
|
|
21
|
+
imageWidthPercent: number
|
|
22
|
+
imageHeightPercent: number
|
|
23
|
+
itemHeight: number
|
|
24
|
+
},
|
|
17
25
|
{}
|
|
18
26
|
>
|
|
19
27
|
export default _default
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export interface LcbProductProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
showTags?: boolean
|
|
8
|
-
showPrice?: boolean
|
|
9
|
-
showScribePrice?: boolean
|
|
10
|
-
showCart?: boolean
|
|
11
|
-
showLocation?: boolean
|
|
12
|
-
showCollection?: boolean
|
|
2
|
+
listType?: 'list' | 'horizontal' | 'grid' | 'waterfall'
|
|
3
|
+
imageWidthPercent?: number
|
|
4
|
+
imageHeightPercent?: number
|
|
5
|
+
itemHeight?: number
|
|
6
|
+
items?: Record<string, any>[]
|
|
13
7
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<
|
|
2
|
+
__VLS_WithDefaults<
|
|
3
|
+
__VLS_TypePropsToOption<{
|
|
4
|
+
prop: string
|
|
5
|
+
className?: string
|
|
6
|
+
}>,
|
|
7
|
+
{}
|
|
8
|
+
>,
|
|
9
|
+
{},
|
|
10
|
+
unknown,
|
|
11
|
+
{},
|
|
12
|
+
{},
|
|
13
|
+
import('vue').ComponentOptionsMixin,
|
|
14
|
+
import('vue').ComponentOptionsMixin,
|
|
15
|
+
{},
|
|
16
|
+
string,
|
|
17
|
+
import('vue').PublicProps,
|
|
18
|
+
Readonly<
|
|
19
|
+
import('vue').ExtractPropTypes<
|
|
20
|
+
__VLS_WithDefaults<
|
|
21
|
+
__VLS_TypePropsToOption<{
|
|
22
|
+
prop: string
|
|
23
|
+
className?: string
|
|
24
|
+
}>,
|
|
25
|
+
{}
|
|
26
|
+
>
|
|
27
|
+
>
|
|
28
|
+
>,
|
|
29
|
+
{},
|
|
30
|
+
{}
|
|
31
|
+
>
|
|
32
|
+
export default _default
|
|
33
|
+
type __VLS_WithDefaults<P, D> = {
|
|
34
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D
|
|
35
|
+
? __VLS_Prettify<
|
|
36
|
+
P[K] & {
|
|
37
|
+
default: D[K]
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
: P[K]
|
|
41
|
+
}
|
|
42
|
+
type __VLS_Prettify<T> = {
|
|
43
|
+
[K in keyof T]: T[K]
|
|
44
|
+
} & {}
|
|
45
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
|
|
46
|
+
type __VLS_TypePropsToOption<T> = {
|
|
47
|
+
[K in keyof T]-?: {} extends Pick<T, K>
|
|
48
|
+
? {
|
|
49
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
type: import('vue').PropType<T[K]>
|
|
53
|
+
required: true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -3,10 +3,20 @@ declare const _default: import('vue').DefineComponent<
|
|
|
3
3
|
__VLS_WithDefaults<
|
|
4
4
|
__VLS_TypePropsToOption<LcbProductItemProps>,
|
|
5
5
|
{
|
|
6
|
-
layoutType:
|
|
6
|
+
layoutType: string
|
|
7
7
|
priceUnit: string
|
|
8
8
|
originPriceUnit: string
|
|
9
|
-
|
|
9
|
+
imageVisible: boolean
|
|
10
|
+
titleVisible: boolean
|
|
11
|
+
subTitleVisible: boolean
|
|
12
|
+
priceVisible: boolean
|
|
13
|
+
priceUnitVisible: boolean
|
|
14
|
+
priceSuffixVisible: boolean
|
|
15
|
+
originPriceVisible: boolean
|
|
16
|
+
originPriceUnitVisible: boolean
|
|
17
|
+
tagsVisible: boolean
|
|
18
|
+
locationVisible: boolean
|
|
19
|
+
distanceVisible: boolean
|
|
10
20
|
}
|
|
11
21
|
>,
|
|
12
22
|
{},
|
|
@@ -23,19 +33,39 @@ declare const _default: import('vue').DefineComponent<
|
|
|
23
33
|
__VLS_WithDefaults<
|
|
24
34
|
__VLS_TypePropsToOption<LcbProductItemProps>,
|
|
25
35
|
{
|
|
26
|
-
layoutType:
|
|
36
|
+
layoutType: string
|
|
27
37
|
priceUnit: string
|
|
28
38
|
originPriceUnit: string
|
|
29
|
-
|
|
39
|
+
imageVisible: boolean
|
|
40
|
+
titleVisible: boolean
|
|
41
|
+
subTitleVisible: boolean
|
|
42
|
+
priceVisible: boolean
|
|
43
|
+
priceUnitVisible: boolean
|
|
44
|
+
priceSuffixVisible: boolean
|
|
45
|
+
originPriceVisible: boolean
|
|
46
|
+
originPriceUnitVisible: boolean
|
|
47
|
+
tagsVisible: boolean
|
|
48
|
+
locationVisible: boolean
|
|
49
|
+
distanceVisible: boolean
|
|
30
50
|
}
|
|
31
51
|
>
|
|
32
52
|
>
|
|
33
53
|
>,
|
|
34
54
|
{
|
|
35
|
-
layoutType:
|
|
55
|
+
layoutType: 'vertical' | 'horizontal'
|
|
36
56
|
priceUnit: any
|
|
37
57
|
originPriceUnit: any
|
|
38
|
-
|
|
58
|
+
imageVisible: boolean
|
|
59
|
+
titleVisible: boolean
|
|
60
|
+
subTitleVisible: boolean
|
|
61
|
+
priceVisible: boolean
|
|
62
|
+
priceUnitVisible: boolean
|
|
63
|
+
priceSuffixVisible: boolean
|
|
64
|
+
originPriceVisible: boolean
|
|
65
|
+
originPriceUnitVisible: boolean
|
|
66
|
+
tagsVisible: boolean
|
|
67
|
+
locationVisible: boolean
|
|
68
|
+
distanceVisible: boolean
|
|
39
69
|
},
|
|
40
70
|
{}
|
|
41
71
|
>
|
|
@@ -1,15 +1,51 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue'
|
|
1
2
|
export interface LcbProductItemProps {
|
|
2
|
-
|
|
3
|
+
className?: string
|
|
4
|
+
layoutType?: 'vertical' | 'horizontal'
|
|
3
5
|
image?: any
|
|
4
6
|
title?: any
|
|
5
7
|
subTitle?: any
|
|
6
8
|
price?: any
|
|
7
9
|
priceUnit?: any
|
|
10
|
+
priceSuffix?: any
|
|
8
11
|
originPrice?: any
|
|
9
12
|
originPriceUnit?: any
|
|
10
|
-
lowestPrice?: any
|
|
11
|
-
lowestPriceUnit?: any
|
|
12
13
|
tags?: any
|
|
13
14
|
location?: any
|
|
14
15
|
distance?: any
|
|
16
|
+
imageVisible?: boolean
|
|
17
|
+
titleVisible?: boolean
|
|
18
|
+
subTitleVisible?: boolean
|
|
19
|
+
priceVisible?: boolean
|
|
20
|
+
priceUnitVisible?: boolean
|
|
21
|
+
priceSuffixVisible?: boolean
|
|
22
|
+
originPriceVisible?: boolean
|
|
23
|
+
originPriceUnitVisible?: boolean
|
|
24
|
+
tagsVisible?: boolean
|
|
25
|
+
locationVisible?: boolean
|
|
26
|
+
distanceVisible?: boolean
|
|
27
|
+
imageClass?: string
|
|
28
|
+
titleClass?: string
|
|
29
|
+
subTitleClass?: string
|
|
30
|
+
priceClass?: string
|
|
31
|
+
priceUnitClass?: string
|
|
32
|
+
priceSuffixClass?: string
|
|
33
|
+
originPriceClass?: string
|
|
34
|
+
originPriceUnitClass?: string
|
|
35
|
+
tagsClass?: string
|
|
36
|
+
tagsWrapperClass?: string
|
|
37
|
+
locationClass?: string
|
|
38
|
+
distanceClass?: string
|
|
39
|
+
imageStyle?: CSSProperties
|
|
40
|
+
titleStyle?: CSSProperties
|
|
41
|
+
subTitleStyle?: CSSProperties
|
|
42
|
+
priceStyle?: CSSProperties
|
|
43
|
+
priceUnitStyle?: CSSProperties
|
|
44
|
+
priceSuffixStyle?: CSSProperties
|
|
45
|
+
originPriceStyle?: CSSProperties
|
|
46
|
+
originPriceUnitStyle?: CSSProperties
|
|
47
|
+
tagsStyle?: CSSProperties
|
|
48
|
+
tagsWrapperStyle?: CSSProperties
|
|
49
|
+
locationStyle?: CSSProperties
|
|
50
|
+
distanceStyle?: CSSProperties
|
|
15
51
|
}
|