|
|
@@ -14,6 +14,7 @@ import {IsCyDialog} from "@/components/cy/dialog/src/useCyDialog";
|
|
|
import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
|
|
|
import {tsxVModel} from "@/utils/cy-use/useTsxUtils";
|
|
|
import {isDev} from "@/utils/public";
|
|
|
+import {useElementVisibility} from '@vueuse/core'
|
|
|
|
|
|
export declare type PageQuery = {
|
|
|
currentPage?: number,
|
|
|
@@ -143,7 +144,7 @@ function useVxeTable<D>(simplifiedConfiguration: SimplifiedConfiguration<D> = {}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- watch(() => props.currentKey, () => {
|
|
|
+ function handleFindKeyScrolling() {
|
|
|
if (stringNotBlank(defaultProps.value.rowConfig?.keyField)) {
|
|
|
const findData = XEUtils.find(tableRef.value?.getData(), (item) => {
|
|
|
// @ts-ignore
|
|
|
@@ -154,8 +155,19 @@ function useVxeTable<D>(simplifiedConfiguration: SimplifiedConfiguration<D> = {}
|
|
|
tableRef.value?.setCurrentRow(findData)
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ watch(() => props.currentKey, () => {
|
|
|
+ handleFindKeyScrolling()
|
|
|
}, {flush: 'post'})
|
|
|
|
|
|
+ const targetIsVisible = useElementVisibility(tableRef)
|
|
|
+
|
|
|
+ watch(() => targetIsVisible.value, (val) => {
|
|
|
+ val && handleFindKeyScrolling()
|
|
|
+ }, {flush: 'post'})
|
|
|
+
|
|
|
+
|
|
|
const defaultProps = computed(() => {
|
|
|
return {
|
|
|
...simplifiedConfiguration?.tableProps,
|