|
1 | | -import { h, ref, computed, getCurrentInstance } from 'vue' |
| 1 | +import { h, ref, computed, getCurrentInstance, toRaw } from 'vue' |
2 | 2 |
|
3 | 3 | import useDark, { useDarkProps } from '../../composables/private/use-dark.js' |
4 | 4 | import useSize, { useSizeProps } from '../../composables/private/use-size.js' |
@@ -61,22 +61,23 @@ export default function (type, getInner) { |
61 | 61 | props.val !== void 0 && Array.isArray(props.modelValue) |
62 | 62 | ) |
63 | 63 |
|
64 | | - const index = computed(() => ( |
65 | | - modelIsArray.value === true |
66 | | - ? props.modelValue.indexOf(props.val) |
| 64 | + const index = computed(() => { |
| 65 | + const val = toRaw(props.val) |
| 66 | + return modelIsArray.value === true |
| 67 | + ? props.modelValue.findIndex(opt => toRaw(opt) === val) |
67 | 68 | : -1 |
68 | | - )) |
| 69 | + }) |
69 | 70 |
|
70 | 71 | const isTrue = computed(() => ( |
71 | 72 | modelIsArray.value === true |
72 | 73 | ? index.value > -1 |
73 | | - : props.modelValue === props.trueValue |
| 74 | + : toRaw(props.modelValue) === toRaw(props.trueValue) |
74 | 75 | )) |
75 | 76 |
|
76 | 77 | const isFalse = computed(() => ( |
77 | 78 | modelIsArray.value === true |
78 | 79 | ? index.value === -1 |
79 | | - : props.modelValue === props.falseValue |
| 80 | + : toRaw(props.modelValue) === toRaw(props.falseValue) |
80 | 81 | )) |
81 | 82 |
|
82 | 83 | const isIndeterminate = computed(() => |
|
0 commit comments