当前位置:网站首页>antd 框架:点击链接重开浏览器页面——基础积累
antd 框架:点击链接重开浏览器页面——基础积累
2022-06-22 07:08:00 【yehaocheng520】
最近在写后台管理系统,遇到一个需求,就是点击某一项,跳转详情页面,此详情页面需要是浏览器的新窗口。

1.浏览器新开页面:window.open(xxx)
通过window.open(xxx)的方式可以打开浏览器的新窗口。
2.页面布局:layouts布局
目前antd框架中的所有页面都是layouts布局,就是有左侧菜单部分,顶部标签部分。但是如果是新开的页面,则最好不要有左侧菜单和顶部标签部分,否则会感觉是同一个系统,而非是一个单开的页面。


相比较而言,最上面的新开页面才是我们想要的。
因此,此时需要在路由上单独处理需要新开的页面。
3.单独定义路由:不继承父级路由的layouts布局

单独定义的路由如下:
{
path: "orderMainNew",
name: "元器件订单信息",
component: () =>
import ("@/pages/orderManagement/orderMain"),
},
4.在新开的页面中:activated方法不生效,需要用watch来监听路由变化
由于antd框架中有使用keep-alive缓存,则如果想要在路由不变化,仅参数改变时,触发页面接口更新的话,则可以使用activated来更新,但是经过测试,通过window.open()打开的新页面是无法触发activated的,则此时可以通过watch监听路由的变化,从而触发详情接口的更新。代码如下:
watch: {
"$route.query.id": {
handler(newVal) {
console.log("监听到id变化");
this.id = newVal;
this.getDetail();
}
immediate: true,
},
},
完成!!!
边栏推荐
- 猿辅导最强暑假计划分享:暑假计划这样做,学习玩耍两不误
- Qt development simple Bluetooth debugging assistant (low power Bluetooth)
- Vector of relevant knowledge of STL Standard Template Library
- CNN模型合集 | Resnet变种-WideResnet解读
- Yolov1 (prediction process)
- 2021-05-12
- Several methods of array de duplication in JS
- Self attention (notes, for personal use)
- OpenGL - Draw Triangle
- About pointer (notes, for personal use)
猜你喜欢

【GAN】《ENERGY-BASED GENERATIVE ADVERSARIAL NETWORKS》 ICLR‘17

Introduction to 51 Single Chip Microcomputer -- the use of Keil uvision4

首次用DBeaver连接mysql报错

Yolov1 (training process)

Process engine solves complex business problems

Advanced usage of setting breakpoints during keil debugging

Introduction to 51 Single Chip Microcomputer -- minimum system of single chip microcomputer

Buuctf part Title WP

Thousands of sails pass by the side of the sunken boat, and thousands of trees spring before the diseased tree

Protection of RT thread critical section
随机推荐
【GAN】SentiGAN IJCAI’18 Distinguished Paper
PIP for source changing and accelerated downloading
希腊字母 - 开发中常用的系统/服务名 - 收集
MySQL面试真题(十八)——经营分析实战
Introduction to 51 single chip microcomputer - LED light
Common evaluation indicators of recommended system: ndcg, recall, precision, hit rate
JS中对数组进行去重的几种方法
6. install the SSH connection tool (used to connect the server of our lab)
Introduction to 51 single chip microcomputer - 8x8 dot matrix LED
JDBC query result set, which is converted into a table
Self supervised learning for general out of distribution detection AAAI '20
咖啡供应链是如何被趟平的?
2022年毕业生求职找工作青睐哪个行业?
Quelles industries les diplômés recherchent - ils en 2022?
[fundamentals of machine learning 01] blending, bagging and AdaBoost
Cesium loading 3D tiles model
流程引擎解决复杂的业务问题
June 21, 2022: golang multiple choice question, what does the following golang code output? A:3; B:4; C:100; D: Compilation failed. package main import ( “fmt“ ) func
[fundamentals of machine learning 03] gbdt (gradient boost decision tree)
【GAN】W-GAN ICLR‘17, ICML‘17