mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +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;
 | 
			
		||||
 | 
			
		||||
const props = defineProps({
 | 
			
		||||
  index: {
 | 
			
		||||
    type: Number,
 | 
			
		||||
    default: 0
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function initechartInstance() {
 | 
			
		||||
  const echartDom = document.querySelector(".bar");
 | 
			
		||||
  const echartDom = document.querySelector(".bar" + props.index);
 | 
			
		||||
  if (!echartDom) return;
 | 
			
		||||
  // @ts-ignore
 | 
			
		||||
  echartInstance = echarts.init(echartDom);
 | 
			
		||||
@ -85,12 +92,5 @@ tryOnUnmounted(() => {
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="bar"></div>
 | 
			
		||||
  <div :class="'bar' + props.index" style="width: 100%; height: 35vh"></div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.bar {
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 35vh;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
@ -12,8 +12,15 @@ import { useEventListener, tryOnUnmounted, useTimeoutFn } from "@vueuse/core";
 | 
			
		||||
 | 
			
		||||
let echartInstance: ECharts;
 | 
			
		||||
 | 
			
		||||
const props = defineProps({
 | 
			
		||||
  index: {
 | 
			
		||||
    type: Number,
 | 
			
		||||
    default: 0
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function initechartInstance() {
 | 
			
		||||
  const echartDom = document.querySelector(".line");
 | 
			
		||||
  const echartDom = document.querySelector(".line" + props.index);
 | 
			
		||||
  if (!echartDom) return;
 | 
			
		||||
  // @ts-ignore
 | 
			
		||||
  echartInstance = echarts.init(echartDom);
 | 
			
		||||
@ -73,12 +80,5 @@ tryOnUnmounted(() => {
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="line"></div>
 | 
			
		||||
  <div :class="'line' + props.index" style="width: 100%; height: 35vh"></div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.line {
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 35vh;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
@ -12,8 +12,15 @@ import { useEventListener, tryOnUnmounted, useTimeoutFn } from "@vueuse/core";
 | 
			
		||||
 | 
			
		||||
let echartInstance: ECharts;
 | 
			
		||||
 | 
			
		||||
const props = defineProps({
 | 
			
		||||
  index: {
 | 
			
		||||
    type: Number,
 | 
			
		||||
    default: 0
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function initechartInstance() {
 | 
			
		||||
  const echartDom = document.querySelector(".pie");
 | 
			
		||||
  const echartDom = document.querySelector(".pie" + props.index);
 | 
			
		||||
  if (!echartDom) return;
 | 
			
		||||
  // @ts-ignore
 | 
			
		||||
  echartInstance = echarts.init(echartDom);
 | 
			
		||||
@ -76,12 +83,5 @@ tryOnUnmounted(() => {
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="pie"></div>
 | 
			
		||||
  <div :class="'pie' + props.index" style="width: 100%; height: 35vh"></div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.pie {
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  height: 35vh;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
@ -568,6 +568,7 @@
 | 
			
		||||
body[layout="vertical"] {
 | 
			
		||||
  $sideBarWidth: 210px;
 | 
			
		||||
  @include merge-style($sideBarWidth);
 | 
			
		||||
 | 
			
		||||
  .el-menu--collapse {
 | 
			
		||||
    width: 54px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user