mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [select-v2] scrollbar resets to top after select item (#21257)
* fix(components): [select-v2] scrollbar resets to top after select item issue #21225 * fix(components): [select-v2] scrollbar resets to top after select item 使用函数包裹能解决isFunction(props.remoteMethod)触发watchEffect的问题 * fix(components): [select-v2] scrollbar resets to top after select item
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
toRaw,
|
||||
watch,
|
||||
watchEffect,
|
||||
} from 'vue'
|
||||
@@ -202,10 +203,10 @@ const useSelect = (props: SelectV2Props, emit: SelectV2EmitFn) => {
|
||||
|
||||
const filterOptions = (query: string) => {
|
||||
const regexp = new RegExp(escapeStringRegexp(query), 'i')
|
||||
const isFilterMethodValid =
|
||||
props.filterable && isFunction(props.filterMethod)
|
||||
const { filterMethod, remoteMethod } = toRaw(props)
|
||||
const isFilterMethodValid = props.filterable && isFunction(filterMethod)
|
||||
const isRemoteMethodValid =
|
||||
props.filterable && props.remote && isFunction(props.remoteMethod)
|
||||
props.filterable && props.remote && isFunction(remoteMethod)
|
||||
const isValidOption = (o: Option): boolean => {
|
||||
if (isFilterMethodValid || isRemoteMethodValid) return true
|
||||
// when query was given, we should test on the label see whether the label contains the given query
|
||||
|
||||
Reference in New Issue
Block a user