From ae7ba21e142abe563cd9eb8c20fc0dcdf9b7a247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8?= <1711467488@qq.com> Date: Mon, 26 Feb 2018 09:30:49 +0800 Subject: [PATCH] no message Former-commit-id: 4889237ba292ffa08e2771bde994e41b53a3ae5d Former-commit-id: 77518f2eee196884613125da484e2a01966cbc6d Former-commit-id: c143f2b77377c04e00570ff1e5e1dca996ac32e9 --- src/pages/demo/chart/dynamicSize/index.vue | 42 ++++++++++++++++------ 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/pages/demo/chart/dynamicSize/index.vue b/src/pages/demo/chart/dynamicSize/index.vue index 8c007185..7309bb01 100644 --- a/src/pages/demo/chart/dynamicSize/index.vue +++ b/src/pages/demo/chart/dynamicSize/index.vue @@ -5,56 +5,56 @@ - + - + - + - + - + - + - + - + @@ -73,41 +73,49 @@ export default { { api: {url: '/api/chart/G2Line', data: {type: 'base'}}, refName: 'G2LineBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2Line', data: {type: 'step'}}, refName: 'G2LineStep', + ready: false, data: [] }, { api: {url: '/api/chart/G2Column', data: {type: 'base'}}, refName: 'G2ColumnBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2Bar', data: {type: 'base'}}, refName: 'G2BarBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2Pie', data: {type: 'base'}}, refName: 'G2PieBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2NightingaleRose', data: {type: 'base'}}, refName: 'G2NightingaleRoseBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2Radar', data: {type: 'base'}}, refName: 'G2RadarBase', + ready: false, data: [] }, { api: {url: '/api/chart/G2Area', data: {type: 'base'}}, refName: 'G2AreaBase', + ready: false, data: [] } ], @@ -134,11 +142,23 @@ export default { } } }, - mounted () { - // 请求图表数据 - this.syncData() + computed: { + ready () { + return !this.chart.find(e => !e.ready) + } + }, + watch: { + ready (ready) { + if (ready) { + this.syncData() + } + } }, methods: { + // 图表 mounted + isReady (index) { + this.chart[index].ready = true + }, // 请求图表数据 syncData () { this.$axios.all(this.chart.map(e => this.$axios.post(e.api.url, e.api.data)))