perf: add reset handle for all content components

This commit is contained in:
tiny-craft 2023-11-09 20:31:07 +08:00
parent 352e7b714d
commit fa4929cd63
6 changed files with 36 additions and 1 deletions

View File

@ -261,6 +261,12 @@ const onUpdateFilter = (filters, sourceColumn) => {
break
}
}
defineExpose({
reset: () => {
clearFilter()
},
})
</script>
<template>

View File

@ -194,6 +194,12 @@ const clearFilter = () => {
const onUpdateFilter = (filters, sourceColumn) => {
valueColumn.filterOptionValue = filters[sourceColumn.key]
}
defineExpose({
reset: () => {
clearFilter()
},
})
</script>
<template>

View File

@ -195,6 +195,12 @@ const clearFilter = () => {
const onUpdateFilter = (filters, sourceColumn) => {
valueColumn.filterOptionValue = filters[sourceColumn.key]
}
defineExpose({
reset: () => {
clearFilter()
},
})
</script>
<template>

View File

@ -184,6 +184,12 @@ const onUpdateFilter = (filters, sourceColumn) => {
break
}
}
defineExpose({
reset: () => {
clearFilter()
},
})
</script>
<template>

View File

@ -8,7 +8,7 @@ import ContentValueZset from '@/components/content_value/ContentValueZSet.vue'
import ContentValueStream from '@/components/content_value/ContentValueStream.vue'
import { useThemeVars } from 'naive-ui'
import useBrowserStore from 'stores/browser.js'
import { computed, onMounted, watch } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import { isEmpty } from 'lodash'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
import useDialogStore from 'stores/dialog.js'
@ -121,10 +121,14 @@ onMounted(() => {
loadData(false, false)
})
const contentRef = ref(null)
watch(
() => data.value?.keyPath,
() => {
// onReload()
if (contentRef.value?.reset != null) {
contentRef.value?.reset()
}
loadData(false, false)
},
)
@ -138,6 +142,7 @@ watch(
</n-empty>
<keep-alive v-else>
<component
ref="contentRef"
:is="valueComponents[data.type]"
:db="data.db"
:decode="data.decode || decodeTypes.NONE"

View File

@ -299,6 +299,12 @@ const onUpdateFilter = (filters, sourceColumn) => {
break
}
}
defineExpose({
reset: () => {
clearFilter()
},
})
</script>
<template>