在目标页面中,可以通过$route对象来获取传递的参数。首先,需要在目标页面的created()或mounted()生命周期钩子函数中获取参数。接下来,可以通过$route对象的params属性来获取传递的参数。

具体实现如下:

// 目标页面接收参数
export default {
  created() {
    // 获取传递的参数
    const item = this.$route.params.item;
    console.log("接收到的参数:==>", item);
  }
}

在路由配置中,需要将参数作为路由的props属性传递给目标页面。具体实现如下:

// 路由配置中传递参数
{
  path: '/equipment/details',
  component: DetailsComponent,
  props: true
}

在跳转时,可以使用$route对象的params属性来传递参数。具体实现如下:

// 跳转并传递参数
this.$router.push({ path: '/equipment/details', params: { item: item } });

这样,就可以在目标页面中获取到传递的参数了

告警记录列表点击事件传值    clickWarningInfoitem      consolelog点击事件传值==item;      this$routerpushpath equipmentdetails     实现页面跳转同时转递参数其中item是json 数据格式 ;目标页面并接受参数

原文地址: http://www.cveoy.top/t/topic/iQ4I 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录