- {{ index != 0 ? '、' : '' }}{{ item.name }}
+ {{ index != 0 ? '、' : '' }}{{ item[props.valueKey] }}
@@ -10,9 +12,14 @@ const props = withDefaults(
defineProps<{
options: any[]
value: any
+ labelKey?: string
+ valueKey?: string
}>(),
{
- options: () => []
+ options: () => [],
+ value: null,
+ labelKey: 'name',
+ valueKey: 'value'
}
)
@@ -25,6 +32,6 @@ const values = computed(() => {
})
const getOptions = computed(() => {
- return props.options.filter((item) => values.value.includes(item.value))
+ return props.options.filter((item) => values.value.includes(item[props.valueKey]))
})
diff --git a/admin/src/components/editor/index.vue b/admin/src/components/editor/index.vue
index 36b23b7..6aa1998 100644
--- a/admin/src/components/editor/index.vue
+++ b/admin/src/components/editor/index.vue
@@ -7,7 +7,7 @@
:mode="mode"
/>