no message
Former-commit-id: e3b67a2ddc2fb017e290f611d473a47cdf2236e8 Former-commit-id: 3af61c66d595657269d437c386770acfb16815fa Former-commit-id: 140e5104f0a246284263ad1aad7b37244fe93c0f
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Container type="ghost" :responsive="true">
|
<Container type="ghost" :responsive="true">
|
||||||
<ChartDemoCard v-bind="card">
|
<ChartDemoCard v-bind="card" @resize="$refs.chart.resize()">
|
||||||
<template slot-scope="{data}">
|
<G2AreaBase slot-scope="{data}" ref="chart" :data="data" v-bind="chart"></G2AreaBase>
|
||||||
<G2AreaBase :data="data" v-bind="chart"></G2AreaBase>
|
|
||||||
</template>
|
|
||||||
</ChartDemoCard>
|
</ChartDemoCard>
|
||||||
</Container>
|
</Container>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header">
|
<div slot="header">
|
||||||
<el-button @click="syncData">加载数据</el-button>
|
<el-button size="mini" @click="syncData">加载数据</el-button>
|
||||||
|
<el-radio-group v-model="height" size="mini">
|
||||||
|
<el-radio-button v-for="(item, index) in heightOptions" :key="index" :label="item">{{item}}px</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
<div :style="style">
|
<div :style="style">
|
||||||
<slot :data="data"></slot>
|
<slot :data="data"></slot>
|
||||||
@@ -21,7 +24,8 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
data: [],
|
data: [],
|
||||||
height: 300
|
height: 300,
|
||||||
|
heightOptions: [300, 400, 500, 600]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -31,6 +35,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
style () {
|
||||||
|
this.resize()
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
// 自动请求一次数据
|
// 自动请求一次数据
|
||||||
this.syncData()
|
this.syncData()
|
||||||
@@ -45,7 +54,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 重新适应大小
|
// 重新适应大小
|
||||||
resize () {
|
resize () {
|
||||||
// this.$refs.chart.resize()
|
this.$nextTick(() => {
|
||||||
|
this.$emit('resize')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user