no message
Former-commit-id: 8d0afd86fcc6f0b159ca240e1be5279d99371902 Former-commit-id: 1ad1c14825da979979c623ae131886c8b42fba02 Former-commit-id: 853dbda698a9cab5a1c230f0a77c47ef9ec546aa
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<Container type="ghost" :responsive="true">
|
<Container type="ghost" :responsive="true">
|
||||||
<ChartDemoCard>
|
<ChartDemoCard v-bind="card">
|
||||||
<template slot-scope="props">
|
<template slot-scope="{data}">
|
||||||
<G2AreaBase :data="props.data" v-bind="chart"></G2AreaBase>
|
<G2AreaBase :data="data" v-bind="chart"></G2AreaBase>
|
||||||
</template>
|
</template>
|
||||||
</ChartDemoCard>
|
</ChartDemoCard>
|
||||||
</Container>
|
</Container>
|
||||||
@@ -16,6 +16,16 @@ export default {
|
|||||||
],
|
],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
// 给卡片容器的参数
|
||||||
|
card: {
|
||||||
|
api: {
|
||||||
|
url: '/api/chart/G2Area',
|
||||||
|
data: {
|
||||||
|
type: 'base'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 给图表的参数
|
||||||
chart: {
|
chart: {
|
||||||
// 图表设置
|
// 图表设置
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
|
<div slot="header">
|
||||||
|
<el-button @click="syncData">加载数据</el-button>
|
||||||
|
</div>
|
||||||
<div :style="style">
|
<div :style="style">
|
||||||
<slot :data="data"></slot>
|
<slot :data="data"></slot>
|
||||||
</div>
|
</div>
|
||||||
@@ -8,6 +11,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
api: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data: [],
|
data: [],
|
||||||
@@ -20,6 +30,23 @@ export default {
|
|||||||
height: this.height + 'px'
|
height: this.height + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
// 自动请求一次数据
|
||||||
|
this.syncData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 请求数据
|
||||||
|
syncData () {
|
||||||
|
this.$axios.post(this.api.url, this.api.data)
|
||||||
|
.then(res => {
|
||||||
|
this.data = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 重新适应大小
|
||||||
|
resize () {
|
||||||
|
// this.$refs.chart.resize()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user