Files
element-plus/packages/select/src/token.ts
jeremywu 790103596c fix(select): fix select value did not match issue (#808)
* fix(select): fix select value did not match issue

- Fix when select's options were added after select is mounted, the value will not match

* fix: options.push cannot trigger watcher

Co-authored-by: 陈婉玉 <simonaliachen@gmail.com>
2020-12-04 13:39:01 +08:00

39 lines
1007 B
TypeScript

import type { ComponentPublicInstance, InjectionKey } from 'vue'
import type { Emitter } from 'mitt'
interface SelectGroupContext {
disabled: boolean
}
export interface SelectContext {
props: {
multiple?: boolean
multipleLimit?: number
valueKey?: string
modelValue?: string | number | unknown[]
popperClass?: string
remote?: boolean
}
selectWrapper: HTMLElement
cachedOptions: any[]
hoverIndex: number
optionsCount: number
filteredOptionsCount: number
options: any[]
selected: any | any[]
selectEmitter: Emitter
setSelected(): void
onOptionCreate(vm: ComponentPublicInstance): void
onOptionDestroy(i: number): void
handleOptionSelect(vm: unknown, byClick: boolean): void
}
export const selectGroupKey: InjectionKey<SelectGroupContext> = Symbol('SelectGroup')
export const selectKey: InjectionKey<SelectContext> = Symbol('Select')
export const selectEvents = {
queryChange: 'elOptionQueryChange',
groupQueryChange: 'elOptionGroupQueryChange',
}