jiaxing.liao před 1 měsícem
rodič
revize
e7de0bf471

+ 2 - 2
src/renderer/src/lvgl-widgets/button-matrix/Config.vue

@@ -345,8 +345,8 @@ const onChangeStateStyle = (field: string, type: 'add' | 'delete') => {
  * 开启/关闭控件部件状态样式
  * @param type
  */
-const onChangeStyleByState = (type: 'add' | 'delete') => {
-  if (type === 'add') {
+const onChangeStyleByState = (type: 'cancel' | 'select') => {
+  if (type === 'select') {
     const { defaultStyle, stateStyle } = getWidgetDefaultStyle()
     // 找多对应样式时添加 状态的样式合并到默认样式
     const result = klona({

+ 2 - 2
src/renderer/src/lvgl-widgets/canvas/Canvas.vue

@@ -180,8 +180,8 @@ const boxStyle = computed(() => {
 const textDecorMap: Record<string, string> = {
   LV_TEXT_DECOR_NONE: 'none',
   LV_TEXT_DECOR_UNDERLINE: 'underline',
-  LV_TEXT_DECOR_STRIKETHROUGH: 'line-through',
-  'LV_TEXT_DECOR_UNDERLINE | LV_TEXT_DECOR_STRIKETHROUGH': 'underline line-through'
+  LV_TEXT_DECOR_STRIKETHROUGH: 'strikethrough',
+  'LV_TEXT_DECOR_UNDERLINE | LV_TEXT_DECOR_STRIKETHROUGH': 'underline&strikethrough'
 }
 
 // 计算图片元素及其本地路径

+ 8 - 1
src/renderer/src/lvgl-widgets/hooks/useWidgetStyle.ts

@@ -47,6 +47,13 @@ type StyleMap = Record<
   }
 >
 
+const decorationMap = {
+  none: 'none',
+  underline: 'underline',
+  strikethrough: 'line-through',
+  'underline&strikethrough': 'underline line-through'
+}
+
 /**
  * 获取样式
  * @param key
@@ -82,7 +89,7 @@ export const getStyle = (key, value, options?: any) => {
 
       style.fontStyle = value?.italic ? 'italic' : 'normal'
       // 装饰
-      style.textDecoration = value?.decoration
+      style.textDecoration = value?.decoration ? decorationMap[value.decoration] : 'none'
 
       // 字形
       switch (value?.weight) {

+ 2 - 2
src/renderer/src/lvgl-widgets/span-group/SpanGroup.vue

@@ -67,11 +67,11 @@ const otherStyles = computed(() => {
 const getSpanStyle = (item: SpanItem & { resolvedStyle: CSSProperties }) => {
   const lineStyle =
     item.text_decor === LineEnum['LV_TEXT_DECOR_UNDERLINE | LV_TEXT_DECOR_STRIKETHROUGH']
-      ? 'underline line-through'
+      ? 'underline&strikethrough'
       : item.text_decor === LineEnum.LV_TEXT_DECOR_UNDERLINE
         ? 'underline'
         : item.text_decor === LineEnum.LV_TEXT_DECOR_STRIKETHROUGH
-          ? 'line-through'
+          ? 'strikethrough'
           : 'none'
 
   return {

+ 1 - 1
src/renderer/src/lvgl-widgets/type.d.ts

@@ -237,7 +237,7 @@ export interface IStyleConfig {
     // 斜体
     italic?: boolean
     // 装饰
-    decoration?: 'underline' | 'strikethrough' | 'underline strikethrough' | 'none'
+    decoration?: 'underline' | 'strikethrough' | 'underline&strikethrough' | 'none'
   }
   // 边框样式
   border?: {

+ 3 - 3
src/renderer/src/views/designer/config/property/components/StyleFont.vue

@@ -67,7 +67,7 @@
         v-model="decoration"
         :variable-config="{
           type: 'enum',
-          enumMap: { 0: 'none', 1: 'underline', 2: 'line-through', 3: 'underline line-through' }
+          enumMap: { 0: 'none', 1: 'underline', 2: 'strikethrough', 3: 'underline&strikethrough' }
         }"
       >
         <el-select-v2
@@ -75,8 +75,8 @@
           :options="[
             { label: 'None', value: 'none' },
             { label: 'Underline', value: 'underline' },
-            { label: 'Strikethrough', value: 'line-through' },
-            { label: 'Underline&Strikethrough', value: 'underline line-through' }
+            { label: 'Strikethrough', value: 'strikethrough' },
+            { label: 'Underline&Strikethrough', value: 'underline&strikethrough' }
           ]"
         />
       </VariableBindWrapper>

+ 2 - 2
src/renderer/src/views/designer/workspace/composite/eventEdit/config.ts

@@ -256,8 +256,8 @@ const styleSchemas: EventStyleSchema[] = [
       options: [
         { label: 'None', value: 'none' },
         { label: 'Underline', value: 'underline' },
-        { label: 'Strikethrough', value: 'line-through' },
-        { label: 'Underline&Strikethrough', value: 'underline line-through' }
+        { label: 'Strikethrough', value: 'strikethrough' },
+        { label: 'Underline&Strikethrough', value: 'underline&strikethrough' }
       ]
     }
   },