fix(components): [select] equal objects cannot destroy instances (#17214)

fix(components): [select]

support value of  type of object

closed #17209

Co-authored-by: zhangdong <a80369@gree.com.cn>
Co-authored-by: qiang <qw13131wang@gmail.com>
This commit is contained in:
锌小子 2024-08-07 15:45:48 +08:00 committed by GitHub
parent 79938178dd
commit b29d82f4e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
// @ts-nocheck // @ts-nocheck
import { computed, getCurrentInstance, inject, toRaw, watch } from 'vue' import { computed, getCurrentInstance, inject, toRaw, watch } from 'vue'
import { get, isEqual } from 'lodash-unified' import { get } from 'lodash-unified'
import { ensureArray, escapeStringRegexp, isObject } from '@element-plus/utils' import { ensureArray, escapeStringRegexp, isObject } from '@element-plus/utils'
import { selectGroupKey, selectKey } from './token' import { selectGroupKey, selectKey } from './token'
@ -78,7 +78,7 @@ export function useOption(props, states) {
(val, oldVal) => { (val, oldVal) => {
const { remote, valueKey } = select.props const { remote, valueKey } = select.props
if (!isEqual(val, oldVal)) { if (val !== oldVal) {
select.onOptionDestroy(oldVal, instance.proxy) select.onOptionDestroy(oldVal, instance.proxy)
select.onOptionCreate(instance.proxy) select.onOptionCreate(instance.proxy)
} }