mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(select): fix tag content error in multiple mode (#641)
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
} from '@element-plus/utils/util'
|
||||
import { elFormKey, elFormItemKey } from '@element-plus/form'
|
||||
import isEqual from 'lodash/isEqual'
|
||||
import { toRawType } from '@vue/shared'
|
||||
|
||||
import type { ElFormContext, ElFormItemContext } from '@element-plus/form'
|
||||
|
||||
@@ -354,14 +355,14 @@ export const useSelect = (props, states: States, ctx) => {
|
||||
|
||||
const getOption = value => {
|
||||
let option
|
||||
const isObject = Object.prototype.toString.call(props.modelValue).toLowerCase() === '[object object]'
|
||||
const isNull = Object.prototype.toString.call(props.modelValue).toLowerCase() === '[object null]'
|
||||
const isUndefined = Object.prototype.toString.call(props.modelValue).toLowerCase() === '[object undefined]'
|
||||
const isObject = toRawType(value).toLowerCase() === 'object'
|
||||
const isNull = toRawType(value).toLowerCase() === 'null'
|
||||
const isUndefined = toRawType(value).toLowerCase() === 'undefined'
|
||||
|
||||
for (let i = states.cachedOptions.length - 1; i >= 0; i--) {
|
||||
const cachedOption = states.cachedOptions[i]
|
||||
const isEqual = isObject
|
||||
? getValueByPath(cachedOption.value, props.valueKey) === getValueByPath(props.modelValue, props.valueKey)
|
||||
? getValueByPath(cachedOption.value, props.valueKey) === getValueByPath(value, props.valueKey)
|
||||
: cachedOption.value === value
|
||||
if (isEqual) {
|
||||
option = {
|
||||
|
||||
Reference in New Issue
Block a user