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)
|
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 =
|
export const scrollToOption =
|
||||||
({ vm, constants }) =>
|
({ vm, constants }) =>
|
||||||
(option) => {
|
(option) => {
|
||||||
|
|
|
@ -107,7 +107,9 @@ import {
|
||||||
computedGetIcon,
|
computedGetIcon,
|
||||||
computedGetTagType,
|
computedGetTagType,
|
||||||
computedShowDropdownIcon,
|
computedShowDropdownIcon,
|
||||||
clearNoMatchValue
|
clearNoMatchValue,
|
||||||
|
debouncedQueryChange,
|
||||||
|
handleDebouncedQueryChange
|
||||||
} from './index'
|
} from './index'
|
||||||
import debounce from '../common/deps/debounce'
|
import debounce from '../common/deps/debounce'
|
||||||
import { isNumber } from '../common/type'
|
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 }),
|
handleOptionSelect: handleOptionSelect({ api, nextTick, props, vm, state }),
|
||||||
getPluginOption: getPluginOption({ api, props, state }),
|
getPluginOption: getPluginOption({ api, props, state }),
|
||||||
toggleCheckAll: toggleCheckAll({ api, emit, state, props }),
|
toggleCheckAll: toggleCheckAll({ api, emit, state, props }),
|
||||||
debouncedQueryChange: debounce(state.debounce, (event) => {
|
handleDebouncedQueryChange: handleDebouncedQueryChange({ state, api }),
|
||||||
api.handleQueryChange(props.shape ? event : event.target.value)
|
debouncedQueryChange: debouncedQueryChange({ props, api }),
|
||||||
}),
|
|
||||||
debouncedOnInputChange: debounce(state.debounce, () => {
|
debouncedOnInputChange: debounce(state.debounce, () => {
|
||||||
api.onInputChange()
|
api.onInputChange()
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue