index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div>
  3. <panel-group />
  4. <el-row :gutter="20">
  5. <el-col :span="10">
  6. <div class="chart__wrap">
  7. <echart :options="pieEchatOptions" :height="'300px'" />
  8. </div>
  9. </el-col>
  10. <el-col :span="14">
  11. <div class="chart__wrap">
  12. <echart :options="barEchatOptions" :height="'300px'" />
  13. </div>
  14. </el-col>
  15. </el-row>
  16. <div class="chart__wrap">
  17. <echart :options="lineEchatOptions" :height="'300px'" />
  18. </div>
  19. </div>
  20. </template>
  21. <script lang="ts">
  22. import { defineComponent, reactive } from 'vue'
  23. import Echart from '_c/Echart/index.vue'
  24. import PanelGroup from './components/PanelGroup.vue'
  25. import { lineOptions, pieOptions, barOptions } from './echart-data'
  26. import type { EChartOption } from 'echarts'
  27. export default defineComponent({
  28. name: 'Dashboard',
  29. components: {
  30. Echart,
  31. PanelGroup
  32. },
  33. setup() {
  34. const lineEchatOptions = reactive<EChartOption>(lineOptions)
  35. const pieEchatOptions = reactive<EChartOption>(pieOptions)
  36. const barEchatOptions = reactive<EChartOption>(barOptions)
  37. return {
  38. lineEchatOptions,
  39. pieEchatOptions,
  40. barEchatOptions
  41. }
  42. }
  43. })
  44. </script>
  45. <style lang="less" scoped>
  46. .chart__wrap {
  47. margin-bottom: 20px;
  48. border-radius: 5px;
  49. background-color: @contentBg;
  50. padding: 10px;
  51. }
  52. </style>