fix: auto format detection may fail
This commit is contained in:
parent
a78c6cdb26
commit
b688ded610
|
@ -1,11 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref, watch } from 'vue'
|
import { computed, reactive, ref, watchEffect } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import ContentToolbar from './ContentToolbar.vue'
|
import ContentToolbar from './ContentToolbar.vue'
|
||||||
import Copy from '@/components/icons/Copy.vue'
|
import Copy from '@/components/icons/Copy.vue'
|
||||||
import Save from '@/components/icons/Save.vue'
|
import Save from '@/components/icons/Save.vue'
|
||||||
import { useThemeVars } from 'naive-ui'
|
import { useThemeVars } from 'naive-ui'
|
||||||
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
|
import { formatTypes } from '@/consts/value_view_type.js'
|
||||||
import { types as redisTypes } from '@/consts/support_redis_type.js'
|
import { types as redisTypes } from '@/consts/support_redis_type.js'
|
||||||
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
import { ClipboardSetText } from 'wailsjs/runtime/runtime.js'
|
||||||
import { isEmpty, toLower } from 'lodash'
|
import { isEmpty, toLower } from 'lodash'
|
||||||
|
@ -60,8 +60,8 @@ const viewLanguage = computed(() => {
|
||||||
|
|
||||||
const viewAs = reactive({
|
const viewAs = reactive({
|
||||||
value: '',
|
value: '',
|
||||||
format: formatTypes.RAW,
|
format: '',
|
||||||
decode: decodeTypes.NONE,
|
decode: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const editingContent = ref('')
|
const editingContent = ref('')
|
||||||
|
@ -76,13 +76,13 @@ const displayValue = computed(() => {
|
||||||
return viewAs.value || decodeRedisKey(props.value)
|
return viewAs.value || decodeRedisKey(props.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watchEffect(
|
||||||
() => props.value,
|
() => {
|
||||||
(val, oldVal) => {
|
if (props.value !== undefined) {
|
||||||
if (val !== undefined) {
|
|
||||||
onFormatChanged(viewAs.decode, viewAs.format)
|
onFormatChanged(viewAs.decode, viewAs.format)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{ flush: 'post' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const converting = ref(false)
|
const converting = ref(false)
|
||||||
|
|
Loading…
Reference in New Issue