fix: the value is not updated after refreshing #90
This commit is contained in:
parent
ab8077999d
commit
988e8e3339
|
@ -77,13 +77,16 @@ const displayValue = computed(() => {
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
(val, oldVal) => {
|
(val, oldVal) => {
|
||||||
if (val !== undefined && oldVal !== undefined) {
|
if (val !== undefined) {
|
||||||
onFormatChanged(viewAs.decode, viewAs.format)
|
onFormatChanged(viewAs.decode, viewAs.format)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const converting = ref(false)
|
||||||
const onFormatChanged = async (decode = '', format = '') => {
|
const onFormatChanged = async (decode = '', format = '') => {
|
||||||
|
try {
|
||||||
|
converting.value = true
|
||||||
const {
|
const {
|
||||||
value,
|
value,
|
||||||
decode: retDecode,
|
decode: retDecode,
|
||||||
|
@ -96,6 +99,9 @@ const onFormatChanged = async (decode = '', format = '') => {
|
||||||
editingContent.value = viewAs.value = value
|
editingContent.value = viewAs.value = value
|
||||||
viewAs.decode = decode || retDecode
|
viewAs.decode = decode || retDecode
|
||||||
viewAs.format = format || retFormat
|
viewAs.format = format || retFormat
|
||||||
|
} finally {
|
||||||
|
converting.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,9 +158,10 @@ const onSave = async () => {
|
||||||
defineExpose({
|
defineExpose({
|
||||||
reset: () => {
|
reset: () => {
|
||||||
viewAs.value = ''
|
viewAs.value = ''
|
||||||
|
viewAs.decode = ''
|
||||||
|
viewAs.format = ''
|
||||||
editingContent.value = ''
|
editingContent.value = ''
|
||||||
},
|
},
|
||||||
beforeShow: () => onFormatChanged(),
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -195,9 +202,9 @@ defineExpose({
|
||||||
</n-button-group>
|
</n-button-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="value-wrapper value-item-part flex-item-expand flex-box-v">
|
<div class="value-wrapper value-item-part flex-item-expand flex-box-v">
|
||||||
<n-spin :show="props.loading" />
|
<n-spin :show="props.loading || converting" />
|
||||||
<content-editor
|
<content-editor
|
||||||
v-show="!props.loading"
|
v-show="!(props.loading || converting)"
|
||||||
:content="displayValue"
|
:content="displayValue"
|
||||||
:language="viewLanguage"
|
:language="viewLanguage"
|
||||||
:loading="props.loading"
|
:loading="props.loading"
|
||||||
|
|
|
@ -156,9 +156,6 @@ const initContent = async () => {
|
||||||
contentRef.value?.reset()
|
contentRef.value?.reset()
|
||||||
}
|
}
|
||||||
await loadData(true, false, '')
|
await loadData(true, false, '')
|
||||||
if (contentRef.value?.beforeShow != null) {
|
|
||||||
await contentRef.value?.beforeShow()
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
initializing.value = false
|
initializing.value = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ onMounted(() => onReload())
|
||||||
size="20"
|
size="20"
|
||||||
t-tooltip="interface.load_all"
|
t-tooltip="interface.load_all"
|
||||||
@click="onLoadAll" />
|
@click="onLoadAll" />
|
||||||
<div class="flex-item-expand" />
|
<div class="flex-item-expand" style="min-width: 10px" />
|
||||||
<icon-button
|
<icon-button
|
||||||
:button-class="['nav-pane-func-btn']"
|
:button-class="['nav-pane-func-btn']"
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
|
|
|
@ -235,7 +235,7 @@ const useTabStore = defineStore('tab', {
|
||||||
tabData.value = assign(value, tabData.value || {})
|
tabData.value = assign(value, tabData.value || {})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tabData.value = value || []
|
tabData.value = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue