@tplc/business 0.7.27 → 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
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.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
|
+
|
|
5
13
|
### [0.7.27](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.26...v0.7.27) (2025-12-22)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -203,11 +203,9 @@ const showArea = computed(() => {
|
|
|
203
203
|
|
|
204
204
|
<style lang="scss" scoped>
|
|
205
205
|
.slot-wrapper {
|
|
206
|
-
|
|
207
|
-
:deep(>
|
|
208
|
-
|
|
209
|
-
:deep(> .lcb-area) {
|
|
210
|
-
width: 100%;
|
|
206
|
+
:deep(> view),
|
|
207
|
+
:deep(> button) {
|
|
208
|
+
width: 100% !important;
|
|
211
209
|
height: auto;
|
|
212
210
|
box-sizing: border-box; // 强化布局,防止溢出
|
|
213
211
|
}
|
|
@@ -1,38 +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
|
-
|
|
26
|
-
|
|
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>
|
|
27
55
|
</template>
|
|
28
56
|
|
|
29
57
|
<script setup lang="ts">
|
|
30
58
|
import { get } from 'lodash-es'
|
|
31
59
|
import { computed } from 'vue'
|
|
32
60
|
import useDynamicData from '../../hooks/useDynamicData'
|
|
33
|
-
import { getFlexStyle } from '../../utils/transform'
|
|
34
|
-
import LcbButtonAction from './components/lcb-button-action/index.vue'
|
|
35
|
-
import LcbButtonContent from './components/lcb-button-content/index.vue'
|
|
61
|
+
import { getFlexStyle, transformValueUnit } from '../../utils/transform'
|
|
36
62
|
import { getDynamicData } from '../../utils/utils'
|
|
37
63
|
import { LcbButtonProps } from './types'
|
|
38
64
|
defineOptions({
|
|
@@ -75,6 +101,14 @@ const shouldRender = computed(() => {
|
|
|
75
101
|
return !!dynamicValue.value
|
|
76
102
|
})
|
|
77
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
|
+
}
|
|
78
112
|
const innerValue = computed(() => {
|
|
79
113
|
if (props.mode === 'image') {
|
|
80
114
|
return dynamicValue.value || props.url
|
|
@@ -87,17 +121,17 @@ const innerValue = computed(() => {
|
|
|
87
121
|
|
|
88
122
|
/** 处理跳转链接中的动态参数 */
|
|
89
123
|
const actionProps = computed(() => {
|
|
124
|
+
// 优化: 提前返回,避免不必要的计算
|
|
125
|
+
if (props.dynamicActionKey) {
|
|
126
|
+
return get(innerDynamicData.value, props.dynamicActionKey)
|
|
127
|
+
}
|
|
128
|
+
|
|
90
129
|
// 优化: 只在 jumpUrl 存在时才调用 getDynamicData
|
|
91
130
|
const jumpUrl = props.action?.jumpUrl
|
|
92
131
|
if (!jumpUrl) {
|
|
93
132
|
return props.action
|
|
94
133
|
}
|
|
95
134
|
|
|
96
|
-
// 优化: 提前返回,避免不必要的计算
|
|
97
|
-
if (props.dynamicActionKey) {
|
|
98
|
-
return get(innerDynamicData.value, props.dynamicActionKey)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
135
|
return {
|
|
102
136
|
...props.action,
|
|
103
137
|
jumpUrl: getDynamicData(jumpUrl, {
|
|
@@ -106,13 +140,58 @@ const actionProps = computed(() => {
|
|
|
106
140
|
}
|
|
107
141
|
})
|
|
108
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
|
+
|
|
109
167
|
// 优化: 将 block customStyle 单独提取
|
|
110
168
|
const blockCustomStyle = computed(() => ({
|
|
111
169
|
width: props.fillWidth ? '100%' : 'fit-content',
|
|
112
170
|
height: props.fillHeight ? '100%' : 'fit-content',
|
|
113
|
-
...
|
|
114
|
-
...getFlexStyle(props.align),
|
|
171
|
+
...innerItemStyle.value,
|
|
115
172
|
}))
|
|
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
|
+
|
|
183
|
+
const blockProps = computed(() => {
|
|
184
|
+
const {
|
|
185
|
+
paddingVertical,
|
|
186
|
+
paddingHorizontal,
|
|
187
|
+
paddingTop,
|
|
188
|
+
paddingBottom,
|
|
189
|
+
paddingLeft,
|
|
190
|
+
paddingRight,
|
|
191
|
+
...other
|
|
192
|
+
} = props
|
|
193
|
+
return other
|
|
194
|
+
})
|
|
116
195
|
</script>
|
|
117
196
|
<style lang="scss" scoped>
|
|
118
197
|
@for $i from 1 through 3 {
|