fix(hooks): [empty-values] warning on modifying computead value (#16508)

* fix(hooks): [empty-values] warning on modifying computead value

* chore: update

* fix: update

* fix: update
This commit is contained in:
btea 2024-04-15 09:27:12 +08:00 committed by GitHub
parent 84f49de955
commit e4306b2eb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import { computed } from 'vue'
import { computed, ref } from 'vue'
import { useGlobalConfig } from '@element-plus/components/config-provider'
import { buildProps, debugWarn, isFunction } from '@element-plus/utils'
@ -27,8 +27,10 @@ export const useEmptyValues = (
props: ExtractPropTypes<typeof useEmptyValuesProps>,
defaultValue?: null | undefined
) => {
const config = useGlobalConfig()
config.value = config.value || {}
let config = useGlobalConfig()
if (!config.value) {
config = ref({})
}
const emptyValues = computed(
() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES