@tplc/business 0.7.26 → 0.7.28
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 +19 -0
- package/components/lcb-area/lcb-area.vue +4 -6
- package/components/lcb-button/components/lcb-button-action/index.vue +0 -10
- package/components/lcb-button/components/lcb-button-content/index.vue +3 -1
- package/components/lcb-button/lcb-button.vue +100 -33
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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.7.28](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.27...v0.7.28) (2025-12-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* area ([33ad1e4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/33ad1e459d9b104d664a4aed33bcf08b52a0f02c))
|
|
11
|
+
* 修改尺寸 ([83ae159](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/83ae159dc058fa0486745149d45f19d7d3a5050a))
|
|
12
|
+
|
|
13
|
+
### [0.7.27](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.26...v0.7.27) (2025-12-22)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ✨ Features | 新功能
|
|
17
|
+
|
|
18
|
+
* 修改样式兼容 ([7b286d6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/7b286d6a299da10f79d02b9565e6e681ce61c494))
|
|
19
|
+
* 兼容area ([3974374](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/39743742aa8426e34d0bd2b321c48e2b1ef2aa37))
|
|
20
|
+
* 兼容padding ([267de42](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/267de42fc3e2f539b5fa47bd8ef2389f8eb57207))
|
|
21
|
+
* 暂时不用处理 ([5c15637](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/5c15637f45bb06a32c8e42a36b01ab98cf1d71a8))
|
|
22
|
+
* 样式调整 ([bd83b18](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/bd83b1815a283f7dcd602dc02ca7644e0c5f2d6d))
|
|
23
|
+
|
|
5
24
|
### [0.7.26](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.25...v0.7.26) (2025-12-22)
|
|
6
25
|
|
|
7
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<lcb-block v-bind="$props" v-if="showArea">
|
|
2
|
+
<lcb-block v-bind="$props" :customClass="`lcb-area`" v-if="showArea">
|
|
3
3
|
<lcb-action-view v-bind="actionProps" v-if="actionProps?.jumpType">
|
|
4
4
|
<view :style="containerStyle" class="h-full">
|
|
5
5
|
<view
|
|
@@ -203,13 +203,11 @@ const showArea = computed(() => {
|
|
|
203
203
|
|
|
204
204
|
<style lang="scss" scoped>
|
|
205
205
|
.slot-wrapper {
|
|
206
|
-
:deep(> view)
|
|
207
|
-
width: 100%;
|
|
208
|
-
height: auto;
|
|
209
|
-
}
|
|
206
|
+
:deep(> view),
|
|
210
207
|
:deep(> button) {
|
|
211
|
-
width: 100
|
|
208
|
+
width: 100% !important;
|
|
212
209
|
height: auto;
|
|
210
|
+
box-sizing: border-box; // 强化布局,防止溢出
|
|
213
211
|
}
|
|
214
212
|
}
|
|
215
213
|
</style>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
v-bind="actionProps"
|
|
4
4
|
@avatar="onAvatar"
|
|
5
5
|
@click="handleClick"
|
|
6
|
-
:customStyle="actionPaddingStyle"
|
|
7
6
|
:renderMode="!actionProps?.jumpType && mode !== 'image' ? 'noClick' : 'button'"
|
|
8
7
|
>
|
|
9
8
|
<lcb-button-content
|
|
@@ -19,7 +18,6 @@
|
|
|
19
18
|
import { LcbButtonProps } from '../../types'
|
|
20
19
|
import { computed } from 'vue'
|
|
21
20
|
import { getDynamicData } from '../../../../utils/utils'
|
|
22
|
-
import { transformValueUnit } from '../../../../utils/transform'
|
|
23
21
|
import { LcbActionViewProps } from '../../../lcb-action-view/types'
|
|
24
22
|
import LcbButtonContent from '../lcb-button-content/index.vue'
|
|
25
23
|
defineOptions({
|
|
@@ -39,14 +37,6 @@ const props = defineProps<
|
|
|
39
37
|
dynamicValue?: string
|
|
40
38
|
}
|
|
41
39
|
>()
|
|
42
|
-
// 优化: 分离 padding 计算和 block props,避免解构整个 props
|
|
43
|
-
const actionPaddingStyle = computed(() => {
|
|
44
|
-
const top = transformValueUnit(props.paddingTop || props.paddingVertical)
|
|
45
|
-
const right = transformValueUnit(props.paddingRight || props.paddingHorizontal)
|
|
46
|
-
const bottom = transformValueUnit(props.paddingBottom || props.paddingVertical)
|
|
47
|
-
const left = transformValueUnit(props.paddingLeft || props.paddingHorizontal)
|
|
48
|
-
return `width: 100%; padding:${top} ${right} ${bottom} ${left}`
|
|
49
|
-
})
|
|
50
40
|
|
|
51
41
|
const onAvatar = (headImgUrl) => {
|
|
52
42
|
props.userStore?.updateUser(
|
|
@@ -1,37 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<template v-if="mode === 'noStyle'">{{ innerValue }}</template>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
<view class="w-full h-full" :style="wrapperStyle" v-else-if="shouldRender">
|
|
4
|
+
<lcb-block
|
|
5
|
+
v-bind="blockProps"
|
|
6
|
+
:customClass="`${customClass} border-solid lcb-button`"
|
|
7
|
+
:customStyle="blockCustomStyle"
|
|
8
|
+
>
|
|
9
|
+
<lcb-action-view
|
|
10
|
+
v-bind="actionProps"
|
|
11
|
+
@avatar="onAvatar"
|
|
12
|
+
@click="handleClick"
|
|
13
|
+
:customStyle="actionPaddingStyle"
|
|
14
|
+
:renderMode="!actionProps?.jumpType && mode !== 'image' ? 'noClick' : 'button'"
|
|
15
|
+
>
|
|
16
|
+
<view class="!flex items-center justify-center" :style="iconGapStyle">
|
|
17
|
+
<wd-icon
|
|
18
|
+
v-if="icon"
|
|
19
|
+
:name="icon"
|
|
20
|
+
class-prefix="lcb"
|
|
21
|
+
:size="transformValueUnit(iconSize)"
|
|
22
|
+
:color="iconColor"
|
|
23
|
+
/>
|
|
24
|
+
<template v-if="mode === 'image'">
|
|
25
|
+
<wd-img
|
|
26
|
+
:src="innerValue"
|
|
27
|
+
:width="transformValueUnit(imageWidth)"
|
|
28
|
+
:mode="imageHeight ? 'aspectFill' : 'widthFix'"
|
|
29
|
+
:height="imageHeight ? transformValueUnit(imageHeight) : 'auto'"
|
|
30
|
+
/>
|
|
31
|
+
</template>
|
|
32
|
+
<template v-else-if="mode === 'qrcode'">
|
|
33
|
+
<wd-qr-code
|
|
34
|
+
:size="qrCodeSize"
|
|
35
|
+
canvasId="qrCode"
|
|
36
|
+
:value="innerValue"
|
|
37
|
+
v-if="innerValue"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
|
+
<template v-else-if="mode === 'progress'">
|
|
41
|
+
<wd-progress :value="innerValue" v-bind="progressProps" />
|
|
42
|
+
</template>
|
|
43
|
+
<text
|
|
44
|
+
v-else
|
|
45
|
+
style="line-height: 1.54"
|
|
46
|
+
class="whitespace-pre-wrap"
|
|
47
|
+
:class="lineClamp ? `line-clamp-${lineClamp}` : ''"
|
|
48
|
+
>
|
|
49
|
+
{{ innerValue }}
|
|
50
|
+
</text>
|
|
51
|
+
</view>
|
|
52
|
+
</lcb-action-view>
|
|
53
|
+
</lcb-block>
|
|
54
|
+
</view>
|
|
26
55
|
</template>
|
|
27
56
|
|
|
28
57
|
<script setup lang="ts">
|
|
29
58
|
import { get } from 'lodash-es'
|
|
30
59
|
import { computed } from 'vue'
|
|
31
60
|
import useDynamicData from '../../hooks/useDynamicData'
|
|
32
|
-
import { getFlexStyle } from '../../utils/transform'
|
|
33
|
-
import LcbButtonAction from './components/lcb-button-action/index.vue'
|
|
34
|
-
import LcbButtonContent from './components/lcb-button-content/index.vue'
|
|
61
|
+
import { getFlexStyle, transformValueUnit } from '../../utils/transform'
|
|
35
62
|
import { getDynamicData } from '../../utils/utils'
|
|
36
63
|
import { LcbButtonProps } from './types'
|
|
37
64
|
defineOptions({
|
|
@@ -74,6 +101,14 @@ const shouldRender = computed(() => {
|
|
|
74
101
|
return !!dynamicValue.value
|
|
75
102
|
})
|
|
76
103
|
|
|
104
|
+
const handleClick = () => {
|
|
105
|
+
if (props.mode === 'image' && innerValue.value && props.enablePreview) {
|
|
106
|
+
uni.previewImage({
|
|
107
|
+
urls: [innerValue.value],
|
|
108
|
+
current: innerValue.value,
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
}
|
|
77
112
|
const innerValue = computed(() => {
|
|
78
113
|
if (props.mode === 'image') {
|
|
79
114
|
return dynamicValue.value || props.url
|
|
@@ -86,17 +121,17 @@ const innerValue = computed(() => {
|
|
|
86
121
|
|
|
87
122
|
/** 处理跳转链接中的动态参数 */
|
|
88
123
|
const actionProps = computed(() => {
|
|
124
|
+
// 优化: 提前返回,避免不必要的计算
|
|
125
|
+
if (props.dynamicActionKey) {
|
|
126
|
+
return get(innerDynamicData.value, props.dynamicActionKey)
|
|
127
|
+
}
|
|
128
|
+
|
|
89
129
|
// 优化: 只在 jumpUrl 存在时才调用 getDynamicData
|
|
90
130
|
const jumpUrl = props.action?.jumpUrl
|
|
91
131
|
if (!jumpUrl) {
|
|
92
132
|
return props.action
|
|
93
133
|
}
|
|
94
134
|
|
|
95
|
-
// 优化: 提前返回,避免不必要的计算
|
|
96
|
-
if (props.dynamicActionKey) {
|
|
97
|
-
return get(innerDynamicData.value, props.dynamicActionKey)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
135
|
return {
|
|
101
136
|
...props.action,
|
|
102
137
|
jumpUrl: getDynamicData(jumpUrl, {
|
|
@@ -105,14 +140,46 @@ const actionProps = computed(() => {
|
|
|
105
140
|
}
|
|
106
141
|
})
|
|
107
142
|
|
|
143
|
+
const onAvatar = (headImgUrl) => {
|
|
144
|
+
userStore?.updateUser(
|
|
145
|
+
{
|
|
146
|
+
headImgUrl,
|
|
147
|
+
},
|
|
148
|
+
true,
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 优化: 缓存样式对象,避免在模板中创建新对象
|
|
153
|
+
const innerStyle = computed(() => {
|
|
154
|
+
return getFlexStyle(props.align)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const innerItemStyle = computed(() => {
|
|
158
|
+
return getFlexStyle(props.itemAlign)
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// 优化: 将 wrapper 样式单独提取
|
|
162
|
+
const wrapperStyle = computed(() => innerStyle.value)
|
|
163
|
+
|
|
164
|
+
// 优化: 将 iconGap 样式单独提取,避免模板字符串
|
|
165
|
+
const iconGapStyle = computed(() => `gap: ${props.iconGap}rpx`)
|
|
166
|
+
|
|
108
167
|
// 优化: 将 block customStyle 单独提取
|
|
109
168
|
const blockCustomStyle = computed(() => ({
|
|
110
169
|
width: props.fillWidth ? '100%' : 'fit-content',
|
|
111
170
|
height: props.fillHeight ? '100%' : 'fit-content',
|
|
112
|
-
...
|
|
113
|
-
...getFlexStyle(props.align),
|
|
171
|
+
...innerItemStyle.value,
|
|
114
172
|
}))
|
|
115
173
|
|
|
174
|
+
// 优化: 分离 padding 计算和 block props,避免解构整个 props
|
|
175
|
+
const actionPaddingStyle = computed(() => {
|
|
176
|
+
const top = transformValueUnit(props.paddingTop || props.paddingVertical)
|
|
177
|
+
const right = transformValueUnit(props.paddingRight || props.paddingHorizontal)
|
|
178
|
+
const bottom = transformValueUnit(props.paddingBottom || props.paddingVertical)
|
|
179
|
+
const left = transformValueUnit(props.paddingLeft || props.paddingHorizontal)
|
|
180
|
+
return `width: 100%; padding:${top} ${right} ${bottom} ${left}`
|
|
181
|
+
})
|
|
182
|
+
|
|
116
183
|
const blockProps = computed(() => {
|
|
117
184
|
const {
|
|
118
185
|
paddingVertical,
|