This commit is contained in:
GGJ
2024-01-02 16:35:07 +08:00
5 changed files with 473 additions and 17 deletions

View File

@@ -9,9 +9,13 @@ import 'echarts/lib/component/dataZoom'
const chartRef = ref<HTMLDivElement>()
const props = defineProps(['options'])
let chart: echarts.ECharts | null = null
let chart: echarts.ECharts | any = null
const resizeHandler = () => {
chart?.resize()
chart.getZr().painter.getViewportRoot().style.display = "none";
requestAnimationFrame(() => {
chart.resize()
chart.getZr().painter.getViewportRoot().style.display = "";
})
}
const initChart = () => {
chart?.dispose()
@@ -88,7 +92,6 @@ const initChart = () => {
],
yAxis: [
{
type: 'value',
nameTextStyle: {
@@ -148,9 +151,7 @@ const initChart = () => {
})
}
onMounted(() => {
setTimeout(() => {
// initChart()
}, 20)
initChart()
window.addEventListener('resize', resizeHandler)
})
defineExpose({ initChart })

View File

@@ -0,0 +1,11 @@
export const defaultAttribute = {
align: 'center',
class: 'ba-data-table w100',
headerCellClassName: 'table-header-cell',
border: true,
stripe: true,
size: 'small',
columnConfig: { resizable: true },
rowConfig: { isCurrent: true, isHover: true },
scrollX: { scrollToLeftOnChange: true },
}

View File

@@ -1,18 +1,9 @@
<template>
<vxe-table
ref='tableRef'
class='ba-data-table w100'
header-cell-class-name='table-header-cell'
:data='tableStore.table.data'
:border='true'
v-loading='tableStore.table.loading'
stripe
size='small'
@checkbox-change='onSelectionChange'
v-bind='$attrs'
:column-config='{resizable: true}'
:tree-config='{}'
:row-config='{isCurrent: true, isHover: true}'
v-bind='Object.assign({}, defaultAttribute, $attrs)'
>
<!-- Column 组件内部是 el-table-column -->
<template v-if='isGroup'>
@@ -88,6 +79,7 @@ import FieldRender from '@/components/table/fieldRender/index.vue'
import Column from '@/components/table/column/index.vue'
import { useConfig } from '@/stores/config'
import type TableStoreClass from '@/utils/tableStore'
import { defaultAttribute } from '@/components/table/defaultAttribute'
const config = useConfig()
const tableRef = ref<TableInstance>()
@@ -102,7 +94,7 @@ const props = withDefaults(defineProps<Props>(), {
pagination: true,
isGroup: false
})
console.log(props)
const onTableSizeChange = (val: number) => {
tableStore.onTableAction('page-size-change', { size: val })
}