no message
Former-commit-id: 8d0afd86fcc6f0b159ca240e1be5279d99371902 Former-commit-id: 1ad1c14825da979979c623ae131886c8b42fba02 Former-commit-id: 853dbda698a9cab5a1c230f0a77c47ef9ec546aa
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<Container type="ghost" :responsive="true">
|
||||
<ChartDemoCard>
|
||||
<template slot-scope="props">
|
||||
<G2AreaBase :data="props.data" v-bind="chart"></G2AreaBase>
|
||||
<ChartDemoCard v-bind="card">
|
||||
<template slot-scope="{data}">
|
||||
<G2AreaBase :data="data" v-bind="chart"></G2AreaBase>
|
||||
</template>
|
||||
</ChartDemoCard>
|
||||
</Container>
|
||||
@@ -16,6 +16,16 @@ export default {
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
// 给卡片容器的参数
|
||||
card: {
|
||||
api: {
|
||||
url: '/api/chart/G2Area',
|
||||
data: {
|
||||
type: 'base'
|
||||
}
|
||||
}
|
||||
},
|
||||
// 给图表的参数
|
||||
chart: {
|
||||
// 图表设置
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<el-button @click="syncData">加载数据</el-button>
|
||||
</div>
|
||||
<div :style="style">
|
||||
<slot :data="data"></slot>
|
||||
</div>
|
||||
@@ -8,6 +11,13 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
api: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
data: [],
|
||||
@@ -20,6 +30,23 @@ export default {
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user