card-1.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div id="card-1">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div id="card_one" style="width: 100%; height: 17vw"></div>
  6. </el-col>
  7. </el-row>
  8. </div>
  9. </template>
  10. <script>
  11. import * as echarts from 'echarts';
  12. import { mapState, createNamespacedHelpers } from 'vuex';
  13. export default {
  14. name: 'index',
  15. props: {},
  16. components: {},
  17. data: function () {
  18. return {};
  19. },
  20. computed: {
  21. ...mapState(['user']),
  22. },
  23. mounted() {
  24. this.getEchartData();
  25. },
  26. created() {},
  27. methods: {
  28. getEchartData(data) {
  29. var chartDom = document.getElementById('card_one');
  30. var myChart = echarts.init(chartDom);
  31. var option;
  32. option = {
  33. title: {
  34. text: '本周下单数',
  35. },
  36. color: '#FFD700',
  37. tooltip: {
  38. trigger: 'axis',
  39. },
  40. xAxis: {
  41. type: 'category',
  42. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  43. },
  44. yAxis: {
  45. type: 'value',
  46. },
  47. series: [
  48. {
  49. data: [150, 230, 224, 218, 135, 147, 260],
  50. type: 'line',
  51. },
  52. ],
  53. };
  54. myChart.setOption(option);
  55. },
  56. },
  57. metaInfo() {
  58. return { title: this.$route.meta.title };
  59. },
  60. watch: {
  61. test: {
  62. deep: true,
  63. immediate: true,
  64. handler(val) {},
  65. },
  66. },
  67. };
  68. </script>
  69. <style lang="less" scoped></style>