修改setProps,重新赋值的时候保留旧值,如果有新的值则覆盖,去掉option.height使用动态计算

pull/120/head
puhui999 2023-04-13 16:47:08 +08:00
parent 6fb5f6f59e
commit 7be96dea0b
1 changed files with 7 additions and 8 deletions

View File

@ -1,11 +1,11 @@
<template>
<VxeGrid v-bind="getProps" ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar">
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
<VxeGrid ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar" v-bind="getProps">
<template v-for="item in Object.keys($slots)" :key="item" #[item]="data">
<slot :name="item" v-bind="data || {}"></slot>
</template>
</VxeGrid>
</template>
<script setup lang="ts" name="XTable">
<script lang="ts" name="XTable" setup>
import { PropType } from 'vue'
import { SizeType, VxeGridInstance } from 'vxe-table'
import { useAppStore } from '@/store/modules/app'
@ -37,7 +37,6 @@ const removeStyles = () => {
allsuspects[i].getAttribute(targetattr) != null &&
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
) {
console.log(allsuspects[i], 'node')
allsuspects[i].parentNode?.removeChild(allsuspects[i])
}
}
@ -90,7 +89,6 @@ const innerProps = ref<Partial<XTableProps>>()
const getProps = computed(() => {
const options = innerProps.value || props.options
options.size = currentSize as any
options.height = 700
getOptionInitConfig(options)
getColumnsConfig(options)
getProxyConfig(options)
@ -254,7 +252,7 @@ const getPageConfig = (options: XTableProps) => {
background: false, //
perfect: false, //
pageSize: 10, //
pagerCount: 7, //
pagerCount: 5, //
autoHidden: false, //
pageSizes: [5, 10, 20, 30, 50, 100], //
layouts: [
@ -272,7 +270,7 @@ const getPageConfig = (options: XTableProps) => {
}
}
// tool bar
// toolbar
const getToolBarConfig = (options: XTableProps) => {
const { toolBar, toolbarConfig, topActionSlots } = options
if (toolbarConfig) return
@ -421,7 +419,8 @@ const getCheckboxRecords = () => {
return g.getCheckboxRecords(false)
}
const setProps = (prop: Partial<XTableProps>) => {
innerProps.value = { ...unref(innerProps), ...prop }
//
innerProps.value = { ...innerProps.value, ...prop, ...props.options }
}
defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList })