File tree Expand file tree Collapse file tree
packages/toolkits/pro/template/tinyvue/src/views/board/home/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77</template >
88
99<script lang="ts" setup>
10- import { onMounted , watch , inject } from ' vue' ;
10+ import { onMounted , watch , inject , ref } from ' vue' ;
1111 import { useI18n } from ' vue-i18n' ;
1212 import useLocale from ' @/hooks/locale' ;
1313
1414 const { t } = useI18n ();
1515 const { currentLocale } = useLocale ();
1616 let echarts = inject <any >(' echarts' );
17+ const echartsDom = ref ();
1718
1819 let option = {
1920 tooltip: {
185186 };
186187
187188 onMounted (() => {
188- const chartDom = document . getElementById ( ' line ' ) ;
189+ const chartDom = echartsDom . value ;
189190 const myChart = echarts .init (chartDom as any );
190191 option && myChart .setOption (option );
191192 window .addEventListener (' resize' , () => {
194195 });
195196
196197 watch (currentLocale , (newValue , oldValue ) => {
197- const chartDom = document . getElementById ( ' line ' ) ;
198+ const chartDom = echartsDom . value ;
198199 const myChart = echarts .init (chartDom as any );
199200 if (newValue === ' zhCN' ) {
200201 option .legend .data = [' 采样PV' , ' 首屏可见' , ' 页面Onload' ];
Original file line number Diff line number Diff line change 77</template >
88
99<script lang="ts" setup>
10- import { onMounted , watch , inject } from ' vue' ;
10+ import { onMounted , watch , inject , ref } from ' vue' ;
1111 import { useI18n } from ' vue-i18n' ;
1212 import useLocale from ' @/hooks/locale' ;
1313
1414 const { t } = useI18n ();
1515 const { currentLocale } = useLocale ();
1616 let echarts = inject <any >(' echarts' );
17+ const echartsDom = ref ();
1718
1819 const list = [
1920 {
167168 };
168169
169170 onMounted (() => {
170- const chartDom = document . getElementById ( ' flow ' ) ;
171+ const chartDom = echartsDom . value ;
171172 const myChart = echarts .init (chartDom as any );
172173 option && myChart .setOption (option );
173174 window .addEventListener (' resize' , () => {
176177 });
177178
178179 watch (currentLocale , (newValue , oldValue ) => {
179- const chartDom = document . getElementById ( ' flow ' ) ;
180+ const chartDom = echartsDom . value ;
180181 const myChart = echarts .init (chartDom as any );
181182 myChart .setOption (option );
182183 });
Original file line number Diff line number Diff line change 1414</template >
1515
1616<script lang="ts" setup>
17- import { onMounted , inject } from ' vue' ;
17+ import { onMounted , inject , ref } from ' vue' ;
1818 import RegionTable from ' ./regiontable.vue' ;
1919
2020 const data = [
5555 ];
5656
5757 let echarts = inject <any >(' echarts' );
58+ const echartsDom = ref ();
5859 let options = {
5960 tooltip: {
6061 trigger: ' item' ,
108109 };
109110
110111 onMounted (() => {
111- const chartDom = document . getElementById ( ' earth ' ) ;
112+ const chartDom = echartsDom . value ;
112113 const myChart = echarts .init (chartDom as any );
113114 window .addEventListener (' resize' , () => {
114115 myChart .resize ();
Original file line number Diff line number Diff line change 1212</template >
1313
1414<script lang="ts" setup>
15- import { onMounted , watch , inject } from ' vue' ;
15+ import { onMounted , watch , inject , ref } from ' vue' ;
1616 import { useI18n } from ' vue-i18n' ;
1717 import useLocale from ' @/hooks/locale' ;
1818 import RoundTable from ' ./roundtable.vue' ;
1919
2020 const { t } = useI18n ();
2121 const { currentLocale } = useLocale ();
2222 let echarts = inject <any >(' echarts' );
23+ const echartsDom = ref ();
2324
2425 let option = {
2526 tooltip: {
6768 };
6869
6970 onMounted (() => {
70- const chartDom = document . getElementById ( ' circled ' ) ;
71+ const chartDom = echartsDom . value ;
7172 const myChart = echarts .init (chartDom as any );
7273 option && myChart .setOption (option );
7374 window .addEventListener (' resize' , () => {
7677 });
7778
7879 watch (currentLocale , (newValue , oldValue ) => {
79- const chartDom = document . getElementById ( ' circled ' ) ;
80+ const chartDom = echartsDom . value ;
8081 const myChart = echarts .init (chartDom as any );
8182 myChart .setOption (option );
8283 });
You can’t perform that action at this time.
0 commit comments