mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
fix: 首页同一图表组件引入多次,只显示一个
This commit is contained in:
parent
ee30cba471
commit
c86aae7b8b
@ -12,8 +12,15 @@ import { useEventListener, tryOnUnmounted, useTimeoutFn } from "@vueuse/core";
|
|||||||
|
|
||||||
let echartInstance: ECharts;
|
let echartInstance: ECharts;
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function initechartInstance() {
|
function initechartInstance() {
|
||||||
const echartDom = document.querySelector(".bar");
|
const echartDom = document.querySelector(".bar" + props.index);
|
||||||
if (!echartDom) return;
|
if (!echartDom) return;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
echartInstance = echarts.init(echartDom);
|
echartInstance = echarts.init(echartDom);
|
||||||
@ -85,12 +92,5 @@ tryOnUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="bar"></div>
|
<div :class="'bar' + props.index" style="width: 100%; height: 35vh"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.bar {
|
|
||||||
width: 100%;
|
|
||||||
height: 35vh;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -12,8 +12,15 @@ import { useEventListener, tryOnUnmounted, useTimeoutFn } from "@vueuse/core";
|
|||||||
|
|
||||||
let echartInstance: ECharts;
|
let echartInstance: ECharts;
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function initechartInstance() {
|
function initechartInstance() {
|
||||||
const echartDom = document.querySelector(".line");
|
const echartDom = document.querySelector(".line" + props.index);
|
||||||
if (!echartDom) return;
|
if (!echartDom) return;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
echartInstance = echarts.init(echartDom);
|
echartInstance = echarts.init(echartDom);
|
||||||
@ -73,12 +80,5 @@ tryOnUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="line"></div>
|
<div :class="'line' + props.index" style="width: 100%; height: 35vh"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.line {
|
|
||||||
width: 100%;
|
|
||||||
height: 35vh;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -12,8 +12,15 @@ import { useEventListener, tryOnUnmounted, useTimeoutFn } from "@vueuse/core";
|
|||||||
|
|
||||||
let echartInstance: ECharts;
|
let echartInstance: ECharts;
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function initechartInstance() {
|
function initechartInstance() {
|
||||||
const echartDom = document.querySelector(".pie");
|
const echartDom = document.querySelector(".pie" + props.index);
|
||||||
if (!echartDom) return;
|
if (!echartDom) return;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
echartInstance = echarts.init(echartDom);
|
echartInstance = echarts.init(echartDom);
|
||||||
@ -76,12 +83,5 @@ tryOnUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="pie"></div>
|
<div :class="'pie' + props.index" style="width: 100%; height: 35vh"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.pie {
|
|
||||||
width: 100%;
|
|
||||||
height: 35vh;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -568,6 +568,7 @@
|
|||||||
body[layout="vertical"] {
|
body[layout="vertical"] {
|
||||||
$sideBarWidth: 210px;
|
$sideBarWidth: 210px;
|
||||||
@include merge-style($sideBarWidth);
|
@include merge-style($sideBarWidth);
|
||||||
|
|
||||||
.el-menu--collapse {
|
.el-menu--collapse {
|
||||||
width: 54px;
|
width: 54px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user