若依VUE 从一个页面跳转另一个页面并携带参数

前言

由于火狐浏览器某些版本不支持 :to写法,测试后把同事的代码优化一下

代码

第一个页面

html 复制代码
		<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-edit" @click="toWinWorker(scope.row, queryParams.createTime)">
              打卡记录
              <!--<router-link :to="'/hcp/windowWorker/index/' + scope.row.winId + '/' + queryParams.createTime" class="link-type" 			size="mini" type="text" style="color: #1890ff">打卡记录</router-link>-->
            </el-button>
          </template>
        </el-table-column>
javascript 复制代码
	/*打卡记录*/
    toWinWorker(row, createTime) {
      const winId = row.winId;
      this.$router.push("/hcp/windowWorker/index/" + winId + "/" + createTime);
    },

跳转路由js

javascript 复制代码
  {
    path: '/hcp',
    component: Layout,
    hidden: true,
    children: [
      {
        path: 'windowWorker/index/:id/:date',
        component: (resolve) => require(['@/views/hcp/windowWorker/index'], resolve),
        name: 'WindowWorker',
        meta: {title: '工作人员打卡记录', icon: ''}
      }
    ]
  },

另一个页面

javascript 复制代码
	// 把携带的参数放到queryParams查询参数里
	created() {
		this.queryParams.winId = this.$route.params && this.$route.params.id;
	    this.queryParams.createTime = this.$route.params && this.$route.params.date;
	},
相关推荐
不爱吃饭爱吃菜38 分钟前
uniapp微信小程序一键授权登录
前端·javascript·vue.js·微信小程序·uni-app
heart000_140 分钟前
从零开始打造个人主页:HTML/CSS/JS实战教程
javascript·css·html
90后小陈老师2 小时前
3D个人简历网站 5.天空、鸟、飞机
前端·javascript·3d
chenbin___2 小时前
react native text 显示 三行 超出部分 中间使用省略号
javascript·react native·react.js
漫路在线5 小时前
JS逆向-某易云音乐下载器
开发语言·javascript·爬虫·python
不爱吃糖的程序媛5 小时前
浅谈前端架构设计与工程化
前端·前端架构设计
BillKu7 小时前
Vue3 Element Plus 对话框加载实现
javascript·vue.js·elementui
郝YH是人间理想7 小时前
系统架构设计师案例分析题——web篇
前端·软件工程
Evaporator Core7 小时前
深入探索:Core Web Vitals 进阶优化与新兴指标
前端·windows
初遇你时动了情8 小时前
html js 原生实现web组件、web公共组件、template模版插槽
前端·javascript·html