mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 代码优化
ISSUES CLOSED: \
This commit is contained in:
@ -31,13 +31,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { useThemeStore } from '@/store';
|
||||
import { useEcharts, type ECOption } from '@/hooks';
|
||||
|
||||
const theme = useThemeStore();
|
||||
|
||||
const darkMode = computed(() => theme.darkMode);
|
||||
import { ref } from 'vue';
|
||||
import { useEcharts, type ECOption } from '@/composables';
|
||||
|
||||
const lineOptions = ref<ECOption>({
|
||||
tooltip: {
|
||||
@ -133,7 +128,7 @@ const lineOptions = ref<ECOption>({
|
||||
}
|
||||
]
|
||||
});
|
||||
const { domRef: lineRef } = useEcharts(lineOptions, darkMode);
|
||||
const { domRef: lineRef } = useEcharts(lineOptions);
|
||||
|
||||
const pieOptions = ref<ECOption>({
|
||||
tooltip: {
|
||||
@ -180,7 +175,7 @@ const pieOptions = ref<ECOption>({
|
||||
}
|
||||
]
|
||||
});
|
||||
const { domRef: pieRef } = useEcharts(pieOptions, darkMode);
|
||||
const { domRef: pieRef } = useEcharts(pieOptions);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -16,13 +16,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { useThemeStore } from '@/store';
|
||||
import { useEcharts, type ECOption } from '@/hooks';
|
||||
|
||||
const theme = useThemeStore();
|
||||
|
||||
const darkMode = computed(() => theme.darkMode);
|
||||
import { ref } from 'vue';
|
||||
import { useEcharts, type ECOption } from '@/composables';
|
||||
|
||||
const pieOptions = ref<ECOption>({
|
||||
legend: {},
|
||||
@ -58,7 +53,7 @@ const pieOptions = ref<ECOption>({
|
||||
}
|
||||
]
|
||||
});
|
||||
const { domRef: pieRef } = useEcharts(pieOptions, darkMode);
|
||||
const { domRef: pieRef } = useEcharts(pieOptions);
|
||||
|
||||
const lineOptions = ref<ECOption>({
|
||||
tooltip: {
|
||||
@ -70,8 +65,26 @@ const lineOptions = ref<ECOption>({
|
||||
}
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: 'Stacked Line'
|
||||
},
|
||||
legend: {
|
||||
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
},
|
||||
yAxis: {
|
||||
@ -79,13 +92,158 @@ const lineOptions = ref<ECOption>({
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||
color: '#37a2da',
|
||||
name: 'Email',
|
||||
type: 'line',
|
||||
smooth: true
|
||||
smooth: true,
|
||||
stack: 'Total',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0.25,
|
||||
color: '#37a2da'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: '#fff'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
color: '#9fe6b8',
|
||||
name: 'Union Ads',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
stack: 'Total',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0.25,
|
||||
color: '#9fe6b8'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: '#fff'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
color: '#fedb5c',
|
||||
name: 'Video Ads',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
stack: 'Total',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0.25,
|
||||
color: '#fedb5c'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: '#fff'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
color: '#fb7293',
|
||||
name: 'Direct',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
stack: 'Total',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0.25,
|
||||
color: '#fb7293'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: '#fff'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
color: '#e7bcf3',
|
||||
name: 'Search Engine',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
stack: 'Total',
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0.25,
|
||||
color: '#e7bcf3'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: '#fff'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
});
|
||||
const { domRef: lineRef } = useEcharts(lineOptions, darkMode);
|
||||
const { domRef: lineRef } = useEcharts(lineOptions);
|
||||
|
||||
const barOptions = ref<ECOption>({
|
||||
tooltip: {
|
||||
@ -108,6 +266,7 @@ const barOptions = ref<ECOption>({
|
||||
{
|
||||
data: [120, 200, 150, 80, 70, 110, 130],
|
||||
type: 'bar',
|
||||
color: '#8378ea',
|
||||
showBackground: true,
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
@ -115,7 +274,7 @@ const barOptions = ref<ECOption>({
|
||||
}
|
||||
]
|
||||
});
|
||||
const { domRef: barRef } = useEcharts(barOptions, darkMode);
|
||||
const { domRef: barRef } = useEcharts(barOptions);
|
||||
|
||||
const scatterOptions = ref<ECOption>({
|
||||
tooltip: {},
|
||||
@ -148,12 +307,13 @@ const scatterOptions = ref<ECOption>({
|
||||
[7.08, 5.82],
|
||||
[5.02, 5.68]
|
||||
],
|
||||
color: '#fedb5c',
|
||||
type: 'scatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { domRef: scatterRef } = useEcharts(scatterOptions, darkMode);
|
||||
const { domRef: scatterRef } = useEcharts(scatterOptions);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
Reference in New Issue
Block a user