修改setProps,重新赋值的时候保留旧值,如果有新的值则覆盖,去掉option.height使用动态计算
parent
6fb5f6f59e
commit
7be96dea0b
|
|
@ -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 })
|
||||
|
|
|
|||
Loading…
Reference in New Issue