no message

Former-commit-id: 0f4dec9260afd64158506873442954bdf58d20c4
Former-commit-id: 160dbe94357a4fa21765c1671d1783bab4282fd9
Former-commit-id: 2dbe3d4c8e3c7e25ef5be1739a11c0b51c131155
This commit is contained in:
李杨
2018-02-19 13:29:50 +08:00
parent 4d4c0d1566
commit 23719d6b91
4 changed files with 120 additions and 4 deletions

View File

@@ -1,5 +1,42 @@
<template>
<Container type="ghost" :responsive="true">
demo
<el-row :gutter="20">
<el-col :span="6">
<ChartDemoControl
@sync="syncData"
:height.sync="height">
</ChartDemoControl>
</el-col>
<el-col :span="18">
<el-card>
<div :style="style">
<G2AreaBase ref="chart" v-bind="chart"></G2AreaBase>
</div>
</el-card>
</el-col>
</el-row>
</Container>
</template>
<script>
import publicMixin from './mixins/public'
export default {
mixins: [
publicMixin
],
data () {
return {
api: {
url: '/api/chart/G2Area',
data: {
type: 'base'
}
},
chart: {
data: []
}
}
}
}
</script>

View File

@@ -0,0 +1,41 @@
<template>
<el-card>
<el-button @click="$emit('sync')">
<Icon name="refresh"></Icon>
重新载入数据
</el-button>
<p>改变容器高度</p>
<el-radio-group v-model="currentHeight" size="small">
<el-radio-button v-for="(item, index) in heightOptions" :key="index" :label="item">{{item}}</el-radio-button>
</el-radio-group>
</el-card>
</template>
<script>
export default {
props: {
height: {
type: Number,
required: false,
default: 0
}
},
data () {
return {
heightOptions: [300, 400, 500, 600],
currentHeight: 0
}
},
created () {
this.currentHeight = this.height
},
watch: {
currentHeight (value) {
if (value !== this.height) {
this.$emit('update:height', value)
}
}
}
}
</script>

View File

@@ -0,0 +1,41 @@
import ChartDemoControl from '../components/ChartDemoControl.vue'
export default {
components: {
ChartDemoControl
},
data () {
return {
height: 300
}
},
mounted () {
this.syncData()
},
computed: {
style () {
return {
height: this.height + 'px'
}
}
},
watch: {
style () {
this.$nextTick(() => {
this.resize()
})
}
},
methods: {
// 请求数据
syncData () {
this.$axios.post(this.api.url, this.api.data)
.then(res => {
this.chart.data = res
})
},
// 重新适应大小
resize () {
this.$refs.chart.resize()
}
}
}

View File

@@ -7,9 +7,6 @@ export const menu = {
requiresAuth: true
},
component: resolve => { require(['@/components/core/MainLayout/index.vue'], resolve) },
redirect: {
name: 'demo-chart-index'
},
children: [
// 所有
{