修改setProps,重新赋值的时候保留旧值,如果有新的值则覆盖,去掉option.height使用动态计算
parent
6fb5f6f59e
commit
7be96dea0b
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<VxeGrid v-bind="getProps" ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar">
|
<VxeGrid ref="xGrid" :class="`${prefixCls}`" class="xtable-scrollbar" v-bind="getProps">
|
||||||
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
|
<template v-for="item in Object.keys($slots)" :key="item" #[item]="data">
|
||||||
<slot :name="item" v-bind="data || {}"></slot>
|
<slot :name="item" v-bind="data || {}"></slot>
|
||||||
</template>
|
</template>
|
||||||
</VxeGrid>
|
</VxeGrid>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts" name="XTable">
|
<script lang="ts" name="XTable" setup>
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { SizeType, VxeGridInstance } from 'vxe-table'
|
import { SizeType, VxeGridInstance } from 'vxe-table'
|
||||||
import { useAppStore } from '@/store/modules/app'
|
import { useAppStore } from '@/store/modules/app'
|
||||||
|
|
@ -37,7 +37,6 @@ const removeStyles = () => {
|
||||||
allsuspects[i].getAttribute(targetattr) != null &&
|
allsuspects[i].getAttribute(targetattr) != null &&
|
||||||
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
|
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
|
||||||
) {
|
) {
|
||||||
console.log(allsuspects[i], 'node')
|
|
||||||
allsuspects[i].parentNode?.removeChild(allsuspects[i])
|
allsuspects[i].parentNode?.removeChild(allsuspects[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +89,6 @@ const innerProps = ref<Partial<XTableProps>>()
|
||||||
const getProps = computed(() => {
|
const getProps = computed(() => {
|
||||||
const options = innerProps.value || props.options
|
const options = innerProps.value || props.options
|
||||||
options.size = currentSize as any
|
options.size = currentSize as any
|
||||||
options.height = 700
|
|
||||||
getOptionInitConfig(options)
|
getOptionInitConfig(options)
|
||||||
getColumnsConfig(options)
|
getColumnsConfig(options)
|
||||||
getProxyConfig(options)
|
getProxyConfig(options)
|
||||||
|
|
@ -254,7 +252,7 @@ const getPageConfig = (options: XTableProps) => {
|
||||||
background: false, // 带背景颜色
|
background: false, // 带背景颜色
|
||||||
perfect: false, // 配套的样式
|
perfect: false, // 配套的样式
|
||||||
pageSize: 10, // 每页大小
|
pageSize: 10, // 每页大小
|
||||||
pagerCount: 7, // 显示页码按钮的数量
|
pagerCount: 5, // 显示页码按钮的数量
|
||||||
autoHidden: false, // 当只有一页时自动隐藏
|
autoHidden: false, // 当只有一页时自动隐藏
|
||||||
pageSizes: [5, 10, 20, 30, 50, 100], // 每页大小选项列表
|
pageSizes: [5, 10, 20, 30, 50, 100], // 每页大小选项列表
|
||||||
layouts: [
|
layouts: [
|
||||||
|
|
@ -272,7 +270,7 @@ const getPageConfig = (options: XTableProps) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tool bar
|
// toolbar
|
||||||
const getToolBarConfig = (options: XTableProps) => {
|
const getToolBarConfig = (options: XTableProps) => {
|
||||||
const { toolBar, toolbarConfig, topActionSlots } = options
|
const { toolBar, toolbarConfig, topActionSlots } = options
|
||||||
if (toolbarConfig) return
|
if (toolbarConfig) return
|
||||||
|
|
@ -421,7 +419,8 @@ const getCheckboxRecords = () => {
|
||||||
return g.getCheckboxRecords(false)
|
return g.getCheckboxRecords(false)
|
||||||
}
|
}
|
||||||
const setProps = (prop: Partial<XTableProps>) => {
|
const setProps = (prop: Partial<XTableProps>) => {
|
||||||
innerProps.value = { ...unref(innerProps), ...prop }
|
// 重新赋值的时候保留旧值,如果有新的值则覆盖
|
||||||
|
innerProps.value = { ...innerProps.value, ...prop, ...props.options }
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList })
|
defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue