forked from opentiny/tiny-vue
fix(select): [select] fix event retargeting in debounce (#1154)
This commit is contained in:
parent
0b79fdd044
commit
0dc0dd25a6
|
@ -191,6 +191,18 @@ export const handleQueryChange =
|
|||
api.defaultOnQueryChange(value)
|
||||
}
|
||||
|
||||
export const debouncedQueryChange =
|
||||
({ props, api }) =>
|
||||
(event) => {
|
||||
const value = props.shape ? event : event.target.value
|
||||
api.handleDebouncedQueryChange(value)
|
||||
}
|
||||
|
||||
export const handleDebouncedQueryChange = ({ state, api }) =>
|
||||
debounce(state.debounce, (value) => {
|
||||
api.handleQueryChange(value)
|
||||
})
|
||||
|
||||
export const scrollToOption =
|
||||
({ vm, constants }) =>
|
||||
(option) => {
|
||||
|
|
|
@ -107,7 +107,9 @@ import {
|
|||
computedGetIcon,
|
||||
computedGetTagType,
|
||||
computedShowDropdownIcon,
|
||||
clearNoMatchValue
|
||||
clearNoMatchValue,
|
||||
debouncedQueryChange,
|
||||
handleDebouncedQueryChange
|
||||
} from './index'
|
||||
import debounce from '../common/deps/debounce'
|
||||
import { isNumber } from '../common/type'
|
||||
|
@ -289,9 +291,8 @@ const addApi = ({ api, props, state, emit, constants, parent, nextTick, dispatch
|
|||
handleOptionSelect: handleOptionSelect({ api, nextTick, props, vm, state }),
|
||||
getPluginOption: getPluginOption({ api, props, state }),
|
||||
toggleCheckAll: toggleCheckAll({ api, emit, state, props }),
|
||||
debouncedQueryChange: debounce(state.debounce, (event) => {
|
||||
api.handleQueryChange(props.shape ? event : event.target.value)
|
||||
}),
|
||||
handleDebouncedQueryChange: handleDebouncedQueryChange({ state, api }),
|
||||
debouncedQueryChange: debouncedQueryChange({ props, api }),
|
||||
debouncedOnInputChange: debounce(state.debounce, () => {
|
||||
api.onInputChange()
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue