fix load saved data
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<kuc-combobox
|
||||
:items="items"
|
||||
:items="items.value"
|
||||
:value="modelValue"
|
||||
@change="updateValue"
|
||||
:key="componentKey"
|
||||
:disabled="selectedAppData.loading == undefined ? false : selectedAppData.loading"
|
||||
/>
|
||||
</template>
|
||||
@@ -11,14 +12,27 @@
|
||||
import type { CachedSelectedAppData } from '@/types/model';
|
||||
import type { KucEvent } from '@/types/my-kintone';
|
||||
import type { DropdownItem } from 'kintone-ui-component';
|
||||
import { defineProps, defineEmits } from 'vue';
|
||||
import { defineProps, defineEmits, type Ref, watch, ref } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
items: DropdownItem[];
|
||||
items: Ref<DropdownItem[]>;
|
||||
modelValue: string;
|
||||
selectedAppData: CachedSelectedAppData;
|
||||
}>();
|
||||
|
||||
const componentKey = ref(0);
|
||||
// fix-bug: force select saved data when load config
|
||||
watch(
|
||||
() => props.items.value,
|
||||
() => {
|
||||
if (!props.modelValue) return;
|
||||
componentKey.value += 1;
|
||||
},
|
||||
{
|
||||
once: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: string): void;
|
||||
}>();
|
||||
|
||||
Reference in New Issue
Block a user