@tplc/business 0.5.75 → 0.5.76

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,13 @@
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.5.76](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.75...v0.5.76) (2025-12-05)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 动态样式 ([85a6aa5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/85a6aa5f60780d6c9e11e12fa7686cab958084cb))
11
+
5
12
  ### [0.5.75](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.69...v0.5.75) (2025-12-04)
6
13
 
7
14
 
package/action.d.ts CHANGED
@@ -110,3 +110,8 @@ export interface TextRenderViewItem {
110
110
  }[]
111
111
  style?: Record<string, any>
112
112
  }
113
+
114
+ export interface DynamicOptions {
115
+ keyFrom?: 'user' | 'context'
116
+ dynamicKey?: string
117
+ }
@@ -18,6 +18,7 @@
18
18
  margin: `${transformValueUnit(floatUp ? -floatUp : marginTop || 0)} ${transformValueUnit(marginRight || marginHorizontal || 0)} ${transformValueUnit(marginBottom || 0)} ${transformValueUnit(marginLeft || marginHorizontal || 0)}`,
19
19
  ...customStyle,
20
20
  ...getFlexStyle(align),
21
+ ...getInnerStyle,
21
22
  }"
22
23
  class="box-border overflow-hidden relative"
23
24
  :class="customClass"
@@ -29,7 +30,9 @@
29
30
  <script setup lang="ts">
30
31
  import { LcbBlockInnerProps } from './types'
31
32
  import { transformValueUnit, getFlexStyle } from '../../utils/transform'
32
- import { computed } from 'vue'
33
+ import { computed, inject, Ref } from 'vue'
34
+ import { PAGE_PROVIDE_KEY } from '../../constants'
35
+ import { get } from 'lodash-es'
33
36
  defineOptions({
34
37
  name: 'LcbBlock',
35
38
  options: {
@@ -47,6 +50,8 @@ const props = withDefaults(defineProps<LcbBlockInnerProps>(), {
47
50
  fontSize: 24,
48
51
  position: 'relative',
49
52
  })
53
+ const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
54
+ const userStore = uni.$lcb.userStore?.()
50
55
  // 透明度+颜色
51
56
  const innerBackgroundColor = computed(() => {
52
57
  if (!props.backgroundColor) return ''
@@ -55,4 +60,25 @@ const innerBackgroundColor = computed(() => {
55
60
  }
56
61
  return props.backgroundColor
57
62
  })
63
+
64
+ const getInnerStyle = computed(() => {
65
+ const innerStyle = Object.keys(props.dynamicStyleOptions).reduce(
66
+ (acc, key) => {
67
+ const currentOptions = props.dynamicStyleOptions[key]
68
+ if (key) {
69
+ const data = get(
70
+ currentOptions.keyFrom === 'user' ? userStore?.userInfo : pageInfo.value,
71
+ currentOptions.dynamicKey,
72
+ )
73
+ if (data) {
74
+ acc[key] = data
75
+ }
76
+ }
77
+
78
+ return acc
79
+ },
80
+ {} as Record<string, string>,
81
+ )
82
+ return innerStyle
83
+ })
58
84
  </script>
@@ -1,3 +1,4 @@
1
+ import { DynamicOptions } from 'action'
1
2
  import { StyleValue } from 'vue'
2
3
 
3
4
  export interface LcbBlockProps {
@@ -55,6 +56,9 @@ export interface LcbBlockProps {
55
56
  | 'bottom-left'
56
57
  | 'bottom-center'
57
58
  | 'bottom-right'
59
+
60
+ // 动态样式集合
61
+ dynamicStyleOptions?: Record<string, DynamicOptions>
58
62
  }
59
63
  export interface LcbBlockInnerProps extends LcbBlockProps {
60
64
  [key: string]: any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.75",
3
+ "version": "0.5.76",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -1,3 +1,4 @@
1
+ import { DynamicOptions } from 'action'
1
2
  export interface LcbBlockProps {
2
3
  /** 左右外距 */
3
4
  marginHorizontal?: number
@@ -53,6 +54,7 @@ export interface LcbBlockProps {
53
54
  | 'bottom-left'
54
55
  | 'bottom-center'
55
56
  | 'bottom-right'
57
+ dynamicStyleOptions?: Record<string, DynamicOptions>
56
58
  }
57
59
  export interface LcbBlockInnerProps extends LcbBlockProps {
58
60
  [key: string]: any
@@ -65,6 +65,7 @@ declare const __VLS_component: import('vue').DefineComponent<
65
65
  | 'bottom-left'
66
66
  | 'bottom-center'
67
67
  | 'bottom-right'
68
+ dynamicStyleOptions: Record<string, import('../../action').DynamicOptions>
68
69
  gap: number
69
70
  imageWidth: number
70
71
  borderRadius: number