3 changed files with 52 additions and 15 deletions
@ -0,0 +1,21 @@ |
|||||||
|
<script setup lang="ts"> |
||||||
|
import { onMounted } from "vue" |
||||||
|
import { useRoute, useRouter } from "vue-router" |
||||||
|
|
||||||
|
const route = useRoute() |
||||||
|
const router = useRouter() |
||||||
|
|
||||||
|
onMounted(() => { |
||||||
|
const url = route.meta.url as string | undefined |
||||||
|
const newPage = !!route.meta.openNewPage |
||||||
|
|
||||||
|
if (url) window.open(url, newPage ? "_blank" : "_self") |
||||||
|
|
||||||
|
// 新开页:当前页别停在空白占位页,回首页/上一页 |
||||||
|
if (newPage) router.replace("/") |
||||||
|
}) |
||||||
|
</script> |
||||||
|
|
||||||
|
<template> |
||||||
|
<div style="padding:16px;">正在打开外部页面...</div> |
||||||
|
</template> |
||||||
Loading…
Reference in new issue