網站首頁 編程語言 正文
跳轉的兩種寫法:
1.使用keep-alive使組件緩存,防止刷新時參數丟失
keep-alive
組件用于緩存和保持組件的狀態,而不是路由參數。它可以在組件切換時保留組件的狀態,從而避免重新渲染和加載數據。keep-alive
主要用于提高頁面性能和用戶體驗,而不涉及路由參數的傳遞和保留。這里使用<keep-alive>
組件是為了在刷新頁面時保持之前傳遞的參數,確保頁面能夠正確地顯示之前的狀態, 其實使用params更合適
<el-table
size="mini"
:data="tableData"
border
style="width: 100%"
:max-height="maxHeight"
>
<el-table-column prop="stationName" label="站點名稱">
<template slot-scope="scope">
<keep-alive>
<span
class="goDetail"
v-hasPermi="['station:detail']"
@click="go2Detail(scope.row)"
>
{{ scope.row.stationName }}
</span>
</keep-alive>
</template>
</el-table-column>
<el-table>
methods: {
// 跳轉到詳情頁面
go2Detail(row) {
this.$router.push({
path: "/site/siteDetail",
query: {
row
}
});
},
}
2.使用router-link , 使用
<router-link>
進行頁面跳轉時,刷新頁面不會丟失攜帶的參數。這是因為<router-link>
在進行路由導航時,會將參數作為路由的一部分,并在刷新頁面時將這些參數保留下來。
<el-table-column label="標準名稱" align="center" :show-overflow-tooltip="false">
<template slot-scope="scope">
<router-link :to="'/water/standard/limit/' + scope.row.id" class="link-type">
<span>{{ scope.row.standardName }}</span>
</router-link>
</template>
</el-table-column>
?需要在router/index.js中配置路由
{
path: '/water',
component: Layout,
hidden: true,
children: [{
path: 'standard/limit/:standardId',
component: (resolve) => require(['@/views/water/standard/limit'], resolve),
name: 'Limit',
meta: {
title: '標準詳情',
icon: ''
}
}]
},
原文鏈接:https://blog.csdn.net/m0_62323730/article/details/132605294
- 上一篇:沒有了
- 下一篇:沒有了
相關推薦
- 2022-03-14 Linux磁盤格式化和掛載(linux服務器硬盤掛載步驟)
- 2022-02-27 Spring Boot -- 創建工程時 Spring Initializr 報錯 Error:co
- 2022-07-01 docker搭建mongodb單節點副本集的實現_docker
- 2022-04-01 C#對Xamarin框架進行數據綁定_C#教程
- 2022-05-13 e engine “node“ is incompatible with this module.
- 2022-06-06 mui柵格布局的兩種方式(grid和list,宮格和列表)
- 2022-06-27 C#為控件添加自定義事件及自定義觸發_C#教程
- 2022-06-25 Android開發實現在TextView前面加標簽示例_Android
- 欄目分類
-
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支