Skip to content

Commit dc5692a

Browse files
committed
ColorOption
1 parent 5ba766a commit dc5692a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/option/ColorOption.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import { NColorPicker } from 'naive-ui'
3+
4+
defineProps<{
5+
value: string
6+
onUpdate: (value: string) => void
7+
}>()
8+
</script>
9+
10+
<template>
11+
<NColorPicker
12+
:modes="['hex']"
13+
show-preview
14+
:value="value"
15+
@update:value="onUpdate"
16+
/>
17+
</template>

src/util.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import IntegerOption from './option/IntegerOption.vue'
55
import BooleanOption from './option/BooleanOption.vue'
66
import EnumOption from './option/EnumOption.vue'
77
import KeyOption from './option/KeyOption.vue'
8+
import ColorOption from './option/ColorOption.vue'
89
import StringOption from './option/StringOption.vue'
910
import ExternalOption from './option/ExternalOption.vue'
1011
import ListOption from './option/ListOption.vue'
@@ -39,6 +40,8 @@ export function toComponent(child: { Type: string, Children?: any[] | null } & {
3940
return EnumOption
4041
case 'Key':
4142
return KeyOption
43+
case 'Color':
44+
return ColorOption
4245
case 'String':
4346
if (child.IsEnum === 'True') {
4447
return EnumOption

0 commit comments

Comments
 (0)