若依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;
	},
相关推荐
lbh17 小时前
当我开始像写代码一样和AI对话,一切都变了
前端·openai·ai编程
We་ct17 小时前
LeetCode 918. 环形子数组的最大和:两种解法详解
前端·数据结构·算法·leetcode·typescript·动态规划·取反
qq_4061761417 小时前
深入浅出 Pinia:Vue3 时代的状态管理新选择
javascript·vue.js·ecmascript
wefly201718 小时前
m3u8live.cn 在线M3U8播放器,免安装高效验流排错
前端·后端·python·音视频·前端开发工具
C澒18 小时前
微前端容器标准化 —— 公共能力篇:通用打印
前端·架构
德育处主任Pro19 小时前
前端元素转图片,dom-to-image-more入门教程
前端·javascript·vue.js
木斯佳19 小时前
前端八股文面经大全:小红书前端一二面OC(下)·(2026-03-17)·面经深度解析
前端·vue3·proxy·八股·响应式
陈天伟教授19 小时前
人工智能应用- 预测新冠病毒传染性:04. 中国:强力措施遏制疫情
前端·人工智能·安全·xss·csrf
叫我一声阿雷吧19 小时前
JS 入门通关手册(23):JS 异步编程:回调函数与异步本质
javascript·es6·前端面试·回调函数·回调地狱·js异步编程·异步本质
zayzy19 小时前
前端八股总结
开发语言·前端·javascript