fix 修复取值错误问题 #2313

This commit is contained in:
xuliangzhan
2024-02-18 22:52:21 +08:00
parent 557bbb0c59
commit bad129d952
9 changed files with 20 additions and 20 deletions

View File

@@ -55,7 +55,7 @@ export default defineComponent({
const xTable = ref({} as VxeTableInstance)
const insertEvent = async (row: any) => {
const insertEvent = async (row?: any) => {
const $table = xTable.value
const record = {
sex: '1'

View File

@@ -29,7 +29,7 @@
"typings": "types/index.d.ts",
"dependencies": {
"dom-zindex": "^1.0.1",
"xe-utils": "^3.5.18"
"xe-utils": "^3.5.20"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.7",

View File

@@ -85,7 +85,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
}
parentChilds[funcName](item)
mapChilds[funcName](item)
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
} else {

View File

@@ -1,4 +1,4 @@
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, VNode, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted, createCommentVNode } from 'vue'
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted, createCommentVNode } from 'vue'
import XEUtils from 'xe-utils'
import GlobalConfig from '../../v-x-e-table/src/conf'
import { useSize } from '../../hooks/size'
@@ -8,7 +8,7 @@ import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
import VxeInputComponent from '../../input/src/input'
import { getSlotVNs } from '../../tools/vn'
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptgroupProps, VxeOptionProps, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeInputDefines } from '../../../types/all'
import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptgroupProps, VxeOptionProps, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeInputDefines, SlotVNodeType } from '../../../types/all'
function isOptionVisible (option: any) {
return option.visible !== false
@@ -157,7 +157,7 @@ export default defineComponent({
return XEUtils.toNumber(props.multiCharOverflow)
})
const callSlot = <T>(slotFunc: ((params: T) => JSX.Element[] | VNode[] | string[]) | string | null, params: T) => {
const callSlot = <T>(slotFunc: ((params: T) => SlotVNodeType | SlotVNodeType[]) | string | null, params: T) => {
if (slotFunc) {
if (XEUtils.isString(slotFunc)) {
slotFunc = slots[slotFunc] || null

View File

@@ -132,9 +132,11 @@ export function getOffsetPos (elem: any, container: any) {
}
export function getAbsolutePos (elem: any) {
// 当主页面嵌套在iframe时elem.getBoundingClientRect()计算在当前body内的边界距离document.body.getBoundingClientRect计算body所在的边界距离
const bodyBounding = document.body.getBoundingClientRect()
const bounding = elem.getBoundingClientRect()
const boundingTop = bounding.top
const boundingLeft = bounding.left
const boundingTop = bounding.top - bodyBounding.top
const boundingLeft = bounding.left - bodyBounding.left
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
}

View File

@@ -28,4 +28,4 @@ export interface VxeEvent {
export type VNodeStyle = Record<string, string | number>
export type VNodeClassName = Record<string, boolean>
export type SlotVNodeType = JSX.Element | VNode | string | number
export type SlotVNodeType = VNode | string | number

View File

@@ -1,5 +1,4 @@
import { VNode } from 'vue'
import { VXEComponent, VNodeStyle } from './component'
import { VXEComponent, VNodeStyle, SlotVNodeType } from './component'
import { VxeFormConstructor, VxeFormDefines, VxeFormPropTypes } from './form'
import { VxeGridConstructor } from './grid'
import { VxeTooltipPropTypes } from './tooltip'
@@ -175,8 +174,8 @@ export namespace VxeFormItemPropTypes {
export type CollapseNode = boolean
export type ItemRender = FormItemRenderOptions
export type Slots = {
title?: string | ((params: FormItemTitleRenderParams) => JSX.Element[] | VNode[] | string[]) | null
default?: string | ((params: FormItemContentRenderParams) => JSX.Element[] | VNode[] | string[]) | null
title?: string | ((params: FormItemTitleRenderParams) => SlotVNodeType | SlotVNodeType[]) | null
default?: string | ((params: FormItemContentRenderParams) => SlotVNodeType | SlotVNodeType[]) | null
}
}

6
types/grid.d.ts vendored
View File

@@ -1,4 +1,4 @@
import { VNode, RenderFunction, SetupContext, Ref, ComputedRef, ComponentPublicInstance, ComponentInternalInstance } from 'vue'
import { RenderFunction, SetupContext, Ref, ComputedRef, ComponentPublicInstance, ComponentInternalInstance } from 'vue'
import { VxeFormInstance, VxeFormProps, VxeFormDefines } from './form'
import { VxeFormItemProps } from './form-item'
import { VxeToolbarInstance, VxeToolbarProps, VxeToolbarPropTypes } from './toolbar'
@@ -268,8 +268,8 @@ export namespace VxeGridPropTypes {
iconOut?: string
}
slots?: {
buttons?: string | ((params: { [key: string]: any }) => VNode[] | string[] | JSX.Element | JSX.Element[])
tools?: string | ((params: { [key: string]: any }) => VNode[] | string[] | JSX.Element | JSX.Element[])
buttons?: string | ((params: { [key: string]: any }) => SlotVNodeType | SlotVNodeType[])
tools?: string | ((params: { [key: string]: any }) => SlotVNodeType | SlotVNodeType[])
}
}

7
types/option.d.ts vendored
View File

@@ -1,5 +1,4 @@
import { VNode } from 'vue'
import { VXEComponent } from './component'
import { VXEComponent, SlotVNodeType } from './component'
import { VxeSelectConstructor } from './select'
/* eslint-disable no-use-before-define */
@@ -36,7 +35,7 @@ export type VxeOptionProps = {
default?: string | ((params: {
option: any
$select: VxeSelectConstructor
}) => JSX.Element[] | VNode[] | string[]) | null
}) => SlotVNodeType | SlotVNodeType[]) | null
}
}
@@ -53,7 +52,7 @@ export namespace VxeOptionPropTypes {
default?: string | ((params: {
option: any
$select: VxeSelectConstructor
}) => JSX.Element[] | VNode[] | string[]) | null
}) => SlotVNodeType | SlotVNodeType[]) | null
}
}