vue方法内跳转 vue超链接传值、查看页面以及父子传值

无按钮 无link 方法内函数直接跳转方法
import router from ‘@/router’

//有参   
router.push({ path: '/record/electricalInfo',query:{} }); // 跳转到B
//无参
 router.push('/record/electricalInfo'); // 跳转到B

在这里插入图片描述

      <el-table-column label="电表编码" align="center" width="120" prop="electricalNum" >
      <template slot-scope="scope">
        <div style="text-align: left">
        <router-link :to="'/equipment/electrical-data/index/' + scope.row.electricalId" class="link-type">
          <span>{{ scope.row.electricalNum }}</span>
        </router-link>
          <div style="white-space:nowrap">初始表码: <span style="color: #1348ce;">{{ scope.row.electricalInitNum}}</span>&nbsp;</div>
          <div style="white-space:nowrap">结算表码: <span style="color: #1348ce;">{{ scope.row.electricalEndNum}}</span>&nbsp;</div>
        </div>
      </template>
      </el-table-column>

router-link 这里需要去/src/router/index.js里面配置

  {
    path: '/equipment/electrical-data',
    component: Layout,
    hidden: true,
    permissions: ['equipment:electrical:list'],
    children: [
      {
        path: 'index/:electricalId(\\d+)',
        component: () => import('@/views/equipment/electrical/electri'),
        name: 'Data',
        meta: { title: '电表详情', activeMenu: '/equipment/electrical' }
      }
    ]
  },

跳转过来是这样的查看页面 :column 是对应的几列展示
在这里插入图片描述

<el-descriptions class="margin-top" title="电表详情" :column="3" :size="'mini'" border>
      <el-descriptions-item>
        <template slot="label">
          电表名称
        </template>
        {{form.electricalName}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          电表品牌
        </template>
        <dict-tag :options="dict.type.sys_meter_brand" :value="form.electricalBrand"/>
      </el-descriptions-item>

    </el-descriptions>

这里是获取$route路由传过来的值

  created() {
    const electricalId = this.$route.params && this.$route.params.electricalId;
  },

##父子传值
父:方法绑定按钮 传入队友的值 直接就携带值跳转到对应路由

    getBillInfo(row,type){
      const electricalId = row.electricalId || this.ids
      this.$router.push({ path: '/finance/bill', query: { electricalId: electricalId,proprietorPayType:type } }) // 跳转到B
    },

子:直接路由.query属性就能获取

  created() {
    console.log(this.$route.query);
    this.queryParams.proprietorPayType=this.$route.query.proprietorPayType;
    this.queryParams.electricalId=this.$route.query.electricalId;
    this.getList();
  },
  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

boJIke

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值