dataease/frontend/src/components/canvas/custom-component/UserView.vue
2021-04-01 11:38:30 +08:00

54 lines
910 B
Vue

<template>
<div class="rect-shape">
<chart-component :ref="element.propValue.id" class="chart-class" :chart="chart" />
</div>
</template>
<script>
import { post } from '@/api/panel/panel'
import ChartComponent from '@/views/chart/components/ChartComponent.vue'
export default {
name: 'UserView',
components: { ChartComponent },
props: {
element: {
type: Object
}
},
data() {
return {
chart: {}
}
},
created() {
this.getData(this.element.propValue.viewId)
},
mounted() {
},
methods: {
getData(id) {
if (id) {
post('/chart/view/getData/' + id, null).then(response => {
// 将视图传入echart组件
this.chart = response.data
})
}
}
}
}
</script>
<style lang="scss" scoped>
.rect-shape {
width: 100%;
height: 100%;
overflow: auto;
}
.chart-class{
height: 100%;
}
</style>