Skip to content

Commit 6e6a1df

Browse files
committed
Open links in new tab in modal actions
Updated the link opening behavior in showCorrectAnswersModal, showModal, and showMapModal to use '_blank' as the default target, ensuring links open in a new browser tab instead of the current one. Update LinkGrid.vue
1 parent 1ec341b commit 6e6a1df

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.vitepress/theme/components/LinkGrid.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function handleClick(item) {
1717
} else if (item.id === "lanzou-quark-mapdl") {
1818
showQuarkMapModal(item);
1919
} else if (item.link) {
20-
window.open(item.link, item.target || "_self");
20+
window.open(item.link, "_blank");
2121
}
2222
}
2323
@@ -210,7 +210,7 @@ function showCorrectAnswersModal(item) {
210210
focusCancel: true,
211211
preConfirm: () => {
212212
if (item.link) {
213-
window.open(item.link, item.target || "_self");
213+
window.open(item.link, "_blank");
214214
}
215215
},
216216
didOpen: () => {
@@ -308,10 +308,10 @@ function showQuarkModal(item) {
308308
}).then((result) => {
309309
if (result.isConfirmed) {
310310
const link = item.quarkLink;
311-
if (link) window.open(link, item.target || "_blank");
311+
if (link) window.open(link, "_blank");
312312
} else if (result.isDenied) {
313313
const link = item.lanzouLink;
314-
if (link) window.open(link, item.target || "_blank");
314+
if (link) window.open(link, "_blank");
315315
}
316316
});
317317
}
@@ -331,7 +331,7 @@ function showModal(item) {
331331
focusCancel: true,
332332
preConfirm: () => {
333333
if (item.link) {
334-
window.open(item.link, item.target || "_self");
334+
window.open(item.link, "_blank");
335335
}
336336
},
337337
willOpen: () => {
@@ -376,10 +376,10 @@ function showQuarkMapModal(item) {
376376
}).then((result) => {
377377
if (result.isConfirmed) {
378378
const link = item.quarkLink;
379-
if (link) window.open(link, item.target || "_blank");
379+
if (link) window.open(link, "_blank");
380380
} else if (result.isDenied) {
381381
const link = item.lanzouLink;
382-
if (link) window.open(link, item.target || "_blank");
382+
if (link) window.open(link, "_blank");
383383
}
384384
});
385385
}
@@ -398,7 +398,7 @@ function showMapModal(item) {
398398
focusCancel: true,
399399
preConfirm: () => {
400400
if (item.link) {
401-
window.open(item.link, item.target || "_self");
401+
window.open(item.link, "_blank");
402402
}
403403
},
404404
willOpen: () => {

0 commit comments

Comments
 (0)