Commit 1108ceb713a2998f011e35ff01c45716145977a9
1 parent
87909fce
fix: DEFECT-736 reset default color after color picker clean color
Showing
2 changed files
with
31 additions
and
2 deletions
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | }, | 20 | }, |
21 | defaultValue: { | 21 | defaultValue: { |
22 | type: String, | 22 | type: String, |
23 | - default: null, | 23 | + default: '', |
24 | }, | 24 | }, |
25 | }); | 25 | }); |
26 | 26 | ||
@@ -54,6 +54,7 @@ | @@ -54,6 +54,7 @@ | ||
54 | const onClear = () => { | 54 | const onClear = () => { |
55 | emit('update:value', props.defaultValue); | 55 | emit('update:value', props.defaultValue); |
56 | unref(picker)?.hide(); | 56 | unref(picker)?.hide(); |
57 | + unref(picker)?.setColor(props.defaultValue); | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | const getOption = computed<ColorPicker.Options>(() => { | 60 | const getOption = computed<ColorPicker.Options>(() => { |
@@ -28,6 +28,11 @@ export enum Gradient { | @@ -28,6 +28,11 @@ export enum Gradient { | ||
28 | SECOND = 'second', | 28 | SECOND = 'second', |
29 | THIRD = 'third', | 29 | THIRD = 'third', |
30 | } | 30 | } |
31 | +export enum GradientColor { | ||
32 | + FIRST = '#67e0e3', | ||
33 | + SECOND = '#37a2da', | ||
34 | + THIRD = '#fd666d', | ||
35 | +} | ||
31 | 36 | ||
32 | export enum visualOptionField { | 37 | export enum visualOptionField { |
33 | FONT_COLOR = 'fontColor', | 38 | FONT_COLOR = 'fontColor', |
@@ -48,6 +53,9 @@ export const modeOne: FormSchema[] = [ | @@ -48,6 +53,9 @@ export const modeOne: FormSchema[] = [ | ||
48 | label: '数值字体颜色', | 53 | label: '数值字体颜色', |
49 | component: 'ColorPicker', | 54 | component: 'ColorPicker', |
50 | changeEvent: 'update:value', | 55 | changeEvent: 'update:value', |
56 | + componentProps: { | ||
57 | + defaultValue: '#000', | ||
58 | + }, | ||
51 | }, | 59 | }, |
52 | ]; | 60 | ]; |
53 | 61 | ||
@@ -57,6 +65,9 @@ export const modeTwo: FormSchema[] = [ | @@ -57,6 +65,9 @@ export const modeTwo: FormSchema[] = [ | ||
57 | label: '数值字体颜色', | 65 | label: '数值字体颜色', |
58 | component: 'ColorPicker', | 66 | component: 'ColorPicker', |
59 | changeEvent: 'update:value', | 67 | changeEvent: 'update:value', |
68 | + componentProps: { | ||
69 | + defaultValue: '#000', | ||
70 | + }, | ||
60 | }, | 71 | }, |
61 | { | 72 | { |
62 | field: visualOptionField.UNIT, | 73 | field: visualOptionField.UNIT, |
@@ -71,6 +82,9 @@ export const modeTwo: FormSchema[] = [ | @@ -71,6 +82,9 @@ export const modeTwo: FormSchema[] = [ | ||
71 | label: '图标颜色', | 82 | label: '图标颜色', |
72 | component: 'ColorPicker', | 83 | component: 'ColorPicker', |
73 | changeEvent: 'update:value', | 84 | changeEvent: 'update:value', |
85 | + componentProps: { | ||
86 | + defaultValue: '#367BFF', | ||
87 | + }, | ||
74 | }, | 88 | }, |
75 | { | 89 | { |
76 | field: visualOptionField.ICON, | 90 | field: visualOptionField.ICON, |
@@ -81,7 +95,6 @@ export const modeTwo: FormSchema[] = [ | @@ -81,7 +95,6 @@ export const modeTwo: FormSchema[] = [ | ||
81 | const color = formModel[visualOptionField.ICON_COLOR]; | 95 | const color = formModel[visualOptionField.ICON_COLOR]; |
82 | return { | 96 | return { |
83 | color, | 97 | color, |
84 | - defaultValue: '#367BFF', | ||
85 | }; | 98 | }; |
86 | }, | 99 | }, |
87 | }, | 100 | }, |
@@ -93,6 +106,9 @@ export const modeThree: FormSchema[] = [ | @@ -93,6 +106,9 @@ export const modeThree: FormSchema[] = [ | ||
93 | label: '数值字体颜色', | 106 | label: '数值字体颜色', |
94 | component: 'ColorPicker', | 107 | component: 'ColorPicker', |
95 | changeEvent: 'update:value', | 108 | changeEvent: 'update:value', |
109 | + componentProps: { | ||
110 | + defaultValue: '#000', | ||
111 | + }, | ||
96 | }, | 112 | }, |
97 | { | 113 | { |
98 | field: visualOptionField.UNIT, | 114 | field: visualOptionField.UNIT, |
@@ -107,6 +123,9 @@ export const modeThree: FormSchema[] = [ | @@ -107,6 +123,9 @@ export const modeThree: FormSchema[] = [ | ||
107 | label: '一阶段颜色', | 123 | label: '一阶段颜色', |
108 | component: 'ColorPicker', | 124 | component: 'ColorPicker', |
109 | changeEvent: 'update:value', | 125 | changeEvent: 'update:value', |
126 | + componentProps: { | ||
127 | + defaultValue: GradientColor.FIRST, | ||
128 | + }, | ||
110 | }, | 129 | }, |
111 | { | 130 | { |
112 | field: visualOptionField.FIRST_PHASE_VALUE, | 131 | field: visualOptionField.FIRST_PHASE_VALUE, |
@@ -122,6 +141,9 @@ export const modeThree: FormSchema[] = [ | @@ -122,6 +141,9 @@ export const modeThree: FormSchema[] = [ | ||
122 | label: '二阶段颜色', | 141 | label: '二阶段颜色', |
123 | component: 'ColorPicker', | 142 | component: 'ColorPicker', |
124 | changeEvent: 'update:value', | 143 | changeEvent: 'update:value', |
144 | + componentProps: { | ||
145 | + defaultValue: GradientColor.SECOND, | ||
146 | + }, | ||
125 | }, | 147 | }, |
126 | { | 148 | { |
127 | field: visualOptionField.SECOND_PHASE_VALUE, | 149 | field: visualOptionField.SECOND_PHASE_VALUE, |
@@ -139,6 +161,9 @@ export const modeThree: FormSchema[] = [ | @@ -139,6 +161,9 @@ export const modeThree: FormSchema[] = [ | ||
139 | label: '三阶段颜色', | 161 | label: '三阶段颜色', |
140 | component: 'ColorPicker', | 162 | component: 'ColorPicker', |
141 | changeEvent: 'update:value', | 163 | changeEvent: 'update:value', |
164 | + componentProps: { | ||
165 | + defaultValue: GradientColor.THIRD, | ||
166 | + }, | ||
142 | }, | 167 | }, |
143 | { | 168 | { |
144 | field: visualOptionField.THIRD_PHASE_VALUE, | 169 | field: visualOptionField.THIRD_PHASE_VALUE, |
@@ -159,6 +184,9 @@ export const modeFour: FormSchema[] = [ | @@ -159,6 +184,9 @@ export const modeFour: FormSchema[] = [ | ||
159 | label: '数值字体颜色', | 184 | label: '数值字体颜色', |
160 | component: 'ColorPicker', | 185 | component: 'ColorPicker', |
161 | changeEvent: 'update:value', | 186 | changeEvent: 'update:value', |
187 | + componentProps: { | ||
188 | + defaultValue: '#000', | ||
189 | + }, | ||
162 | }, | 190 | }, |
163 | { | 191 | { |
164 | field: visualOptionField.UNIT, | 192 | field: visualOptionField.UNIT, |