no message

Former-commit-id: 91c70ca8b8244d4165aa983d3e6dbb478b36c07d
Former-commit-id: 2c1f556affcc8da6b524dc81832883bae7097f69
Former-commit-id: 3de5c80d0d93178bceb291028421152701014726
This commit is contained in:
李杨
2018-02-17 13:03:38 +08:00
parent a65282bbc0
commit acf3e04639
5 changed files with 22 additions and 20 deletions

View File

@@ -1,3 +1,3 @@
// import Vue from 'vue'
import Vue from 'vue'
// Vue.component('G2Line1', resolve => { require(['@/components/G2/charts/Line/1.vue'], resolve) })
Vue.component('G2LineBase', resolve => { require(['@/components/charts/G2/components/Line/base.vue'], resolve) })

View File

@@ -2,5 +2,5 @@
import './core'
// 非核心组件 只是在很多演示页面中用到的组件
import './demo'
// 图表组件 G2
import './charts/G2'
// 图表组件
import './charts'

View File

@@ -7,7 +7,7 @@
@resized="resizedHandler('G2Line1')">
<el-card class="header-in">
<div slot="header">近年趋势</div>
<G2LineBase v-bind="chart[0]"></G2LineBase>
</el-card>
</GridItem>
</GridLayout>

View File

@@ -1,27 +1,29 @@
export default {
data () {
return {}
return {
chart: [
{
data: []
}
]
}
},
mounted () {
// 请求图表数据
// this.syncData()
this.syncData()
},
methods: {
// 请求图表数据
syncData () {
// const api = [
// {url: '/api/chart/G2Line', data: {code: 1}},
// {url: '/api/chart/G2Pie', data: {code: 1}},
// {url: '/api/chart/G2Column', data: {code: 1}}
// ]
// this.$axios.all(api.map(e => this.$axios.post(e.url, e.data)))
// .then(this.$axios.spread((G2Line1, G2Pie1, G2Column1) => {
// this.chartData = {
// G2Line1,
// G2Pie1,
// G2Column1
// }
// }))
const api = [
{url: '/api/chart/G2Line', data: {code: 1}}
]
this.$axios.all(api.map(e => this.$axios.post(e.url, e.data)))
.then(this.$axios.spread((...res) => {
res.forEach((e, index) => {
this.chart[index].data = e
})
}))
}
}
}