|  | @ -1,5 +1,5 @@ | 
			
		
	
		
		
			
				
					|  |  | <template> |  |  | <template> | 
			
		
	
		
		
			
				
					
					|  |  |   <div ref="echartsContainerRef" v-bind="attrs"> |  |  |   <div ref="echartsContainerRef" v-bind="attrs" class="h-full"> | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     <q-resize-observer debounce="500" @resize="onResize" /> |  |  |     <q-resize-observer debounce="500" @resize="onResize" /> | 
			
		
	
		
		
			
				
					|  |  |     <div ref="echartsRef" style="width: 100%; height: 100%"></div> |  |  |     <div ref="echartsRef" style="width: 100%; height: 100%"></div> | 
			
		
	
		
		
			
				
					|  |  |   </div> |  |  |   </div> | 
			
		
	
	
		
		
			
				
					|  | @ -44,32 +44,27 @@ const getSize = () => { | 
			
		
	
		
		
			
				
					|  |  |  * 初始化 Echarts |  |  |  * 初始化 Echarts | 
			
		
	
		
		
			
				
					|  |  |  */ |  |  |  */ | 
			
		
	
		
		
			
				
					|  |  | const initEcharts = () => { |  |  | const initEcharts = () => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts initEcharts'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   const size = getSize(); |  |  |   const size = getSize(); | 
			
		
	
		
		
			
				
					|  |  |   const dom: HTMLElement | null = echartsRef.value; |  |  |   const dom: HTMLElement | null = echartsRef.value; | 
			
		
	
		
		
			
				
					|  |  |   echartsObject = echarts.init(dom, null, size); |  |  |   echartsObject = echarts.init(dom, null, size); | 
			
		
	
		
		
			
				
					|  |  | }; |  |  | }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | const setOption = (option) => { |  |  | const setOption = (option) => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts setOption'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   echartsOption = option; |  |  |   echartsOption = option; | 
			
		
	
		
		
			
				
					|  |  |   echartsObject.setOption(echartsOption); |  |  |   echartsObject.setOption(echartsOption); | 
			
		
	
		
		
			
				
					|  |  | }; |  |  | }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | const setOptionFromUrl = () => { |  |  | const setOptionFromUrl = () => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts setOptionFromUrl'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   axios.get(props.optionUrl).then((response) => { |  |  |   axios.get(props.optionUrl).then((response) => { | 
			
		
	
		
		
			
				
					|  |  |     setOption(response.data); |  |  |     setOption(response.data); | 
			
		
	
		
		
			
				
					|  |  |   }); |  |  |   }); | 
			
		
	
		
		
			
				
					|  |  | }; |  |  | }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | const resize = (size) => { |  |  | const resize = (size) => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts resized'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   echartsObject?.resize(size); |  |  |   echartsObject?.resize(size); | 
			
		
	
		
		
			
				
					|  |  | }; |  |  | }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | onMounted(() => { |  |  | onMounted(() => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts onMounted'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   initEcharts(); |  |  |   initEcharts(); | 
			
		
	
		
		
			
				
					|  |  |   if (props.optionUrl) { |  |  |   if (props.optionUrl) { | 
			
		
	
		
		
			
				
					|  |  |     setOptionFromUrl(); |  |  |     setOptionFromUrl(); | 
			
		
	
	
		
		
			
				
					|  | @ -79,7 +74,6 @@ onMounted(() => { | 
			
		
	
		
		
			
				
					|  |  | }); |  |  | }); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | onUpdated(() => { |  |  | onUpdated(() => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts onUpdated'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   if (props.optionUrl) { |  |  |   if (props.optionUrl) { | 
			
		
	
		
		
			
				
					|  |  |     setOptionFromUrl(); |  |  |     setOptionFromUrl(); | 
			
		
	
		
		
			
				
					|  |  |   } else { |  |  |   } else { | 
			
		
	
	
		
		
			
				
					|  | @ -91,7 +85,6 @@ onUpdated(() => { | 
			
		
	
		
		
			
				
					|  |  |  * 语言改变事件 |  |  |  * 语言改变事件 | 
			
		
	
		
		
			
				
					|  |  |  */ |  |  |  */ | 
			
		
	
		
		
			
				
					|  |  | eventBus.on('onLocaleChanged', (local) => { |  |  | eventBus.on('onLocaleChanged', (local) => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts onLocaleChanged'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   echartsObject?.setOption(echartsOption); |  |  |   echartsObject?.setOption(echartsOption); | 
			
		
	
		
		
			
				
					|  |  |   echartsObject?.resize(); |  |  |   echartsObject?.resize(); | 
			
		
	
		
		
			
				
					|  |  | }); |  |  | }); | 
			
		
	
	
		
		
			
				
					|  | @ -100,7 +93,6 @@ eventBus.on('onLocaleChanged', (local) => { | 
			
		
	
		
		
			
				
					|  |  |  * 窗口大小发生变化 |  |  |  * 窗口大小发生变化 | 
			
		
	
		
		
			
				
					|  |  |  */ |  |  |  */ | 
			
		
	
		
		
			
				
					|  |  | const onResize = (size) => { |  |  | const onResize = (size) => { | 
			
		
	
		
		
			
				
					|  |  |   console.log('echarts onResize'); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |   resize(size); |  |  |   resize(size); | 
			
		
	
		
		
			
				
					|  |  | }; |  |  | }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | 
 |