cssjshtml vue-echart 点击跳转传参和接收

葫芦的运维日志

浏览量 5534 2019/03/05 17:09

1.vue-echart  点击跳转通过路由传参。

<template>
  <div :style="{height: height + 'px'}">
    <IEcharts :option="line_option" :loading="loading" @ready="onReady" @click="onClick"></IEcharts>
  </div>
</template>

    methods: {
      onClick(event, instance, ECharts) {
        let date = new Date(event.name.slice(0, 4) + '/' + event.name.slice(4, 6) + '/' + event.name.slice(6, 8))
        let starttime = date
        let endtime = new Date(date.getTime() + 24 * 60 * 60 * 1000)

        this.$router.push({
          path: "Detail",
          name: "告警详情",
          params: {
            timevalue: [starttime, endtime]
          }
        })
      }
}

2.跳转页面参数接收:

created: function () {
  
if (this.$route.params.timevalue) {
this.timevalue = this.$route.params.timevalue
console.log(this.timevalue)
}
}

 

葫芦的运维日志

打赏

留言板

留言提交后需管理员审核通过才会显示

© 冰糖葫芦甜(bthlt.com) 2025 王梓打赏联系方式陕ICP备17005322号-1