表格样式

This commit is contained in:
zhaotiantian
2023-12-11 13:27:27 +08:00
parent bc15167485
commit 66175f4b4b
3 changed files with 172 additions and 120 deletions
+64 -64
View File
@@ -1,76 +1,76 @@
<template>
<div>
<public-title :title="props.title">
<template #title>
{{ props.tips }}
</template>
</public-title>
<div class="inner" ref="healthChart"></div>
</div>
<div>
<public-title :title="props.title">
<template #right>
{{ props.tips }}
</template>
</public-title>
<div class="inner" ref="healthChart"></div>
</div>
</template>
<script setup lang="ts">
import PublicTitle from '/@/components/publicTitle.vue';
import { useSpin } from '/@/components/body-d-left/bodyLeftHooks.ts';
import { useHealth } from '/@/components/body-d-right/bodyRightHooks.ts';
import { screenPie } from '/@/components/item-d/pieCharts.ts';
import { onMounted, ref, unref, watch } from 'vue';
import * as echarts from 'echarts';
import PublicTitle from '/@/components/publicTitle.vue';
import {useSpin} from '/@/components/body-d-left/bodyLeftHooks.ts';
import {useHealth} from '/@/components/body-d-right/bodyRightHooks.ts';
import {screenPie} from '/@/components/item-d/pieCharts.ts';
import {onMounted, ref, unref, watch} from 'vue';
import * as echarts from 'echarts';
const props = defineProps({
title: {
type: String,
default: () => '',
},
data: {
type: Array,
default: () => [],
},
color: {
type: Array,
default: () => [],
},
tips: {
type: String,
default: () => '',
},
});
const healthChart = ref<HTMLElement>();
const props = defineProps({
title: {
type: String,
default: () => '',
},
data: {
type: Array,
default: () => [],
},
color: {
type: Array,
default: () => [],
},
tips: {
type: String,
default: () => '',
},
});
const healthChart = ref<HTMLElement>();
const { setSpin, spinning } = useSpin();
const {setSpin, spinning} = useSpin();
onMounted(() => {
init();
});
onMounted(() => {
init();
});
watch(
() => props.data,
() => {
init();
}
);
const { healthData, getValue, setHealth } = useHealth();
async function init() {
// setHealth(props.data);
// const yData = unref(getValue);
// let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
initChart(props.data, 78, props.color);
watch(
() => props.data,
() => {
init();
}
);
function initChart(chartData, total, color) {
let myChart = echarts.init(healthChart.value);
let options = screenPie(chartData, total, color);
myChart.setOption(options);
window.addEventListener('resize', () => {
myChart.resize();
});
}
const {healthData, getValue, setHealth} = useHealth();
async function init() {
// setHealth(props.data);
// const yData = unref(getValue);
// let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
initChart(props.data, 78, props.color);
}
function initChart(chartData, total, color) {
let myChart = echarts.init(healthChart.value);
let options = screenPie(chartData, total, color);
myChart.setOption(options);
window.addEventListener('resize', () => {
myChart.resize();
});
}
</script>
<style scoped lang="less">
.inner {
width: 90%;
margin: 0 auto;
height: calc(100% - 40px);
}
.inner {
width: 90%;
margin: 0 auto;
height: calc(100% - 40px);
}
</style>