From e9842dae70d9717b3074c7f23e95106af9c0b7bc Mon Sep 17 00:00:00 2001 From: yubaolee Date: Thu, 10 Apr 2025 10:35:54 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=AE=8C=E5=96=84=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E7=AB=99=E7=82=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/pro/openurl.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/pro/openurl.md b/docs/pro/openurl.md index 71c016c3..cce2fa69 100644 --- a/docs/pro/openurl.md +++ b/docs/pro/openurl.md @@ -2,21 +2,25 @@ 上一章节通过添加模块或直接在路由表中添加固定路由实现路由控制。在有些场景下,需要代码中直接打开一个外部指定URL的地址(不通过系统的【模块管理】功能添加到导航栏),如下图: -![20220331231338](http://img.openauth.net.cn/20220331231338.png) +![2025-04-10-10-34-19](http://img.openauth.net.cn/2025-04-10-10-34-19.png) 可以直接使用下面代码实现: ```javascript - openUrl() { - let obj = {} - obj['openauth'] = { //这里的openauth可以改成你希望在浏览器地址栏中看到的url - name: '官网', - url: 'http://www.openauth.net.cn', +const openUrl = () => { + const routes = router.getRoutes() + routes.forEach(route => { + if (route.path === '/redirect/iframe') { + route.meta.title = 'OpenAuth.Net官网' // 设置标题 } - this.$store.dispatch('setIframeTagViews', obj, { root: true }) - - this.$router.push({ path: '/iframePage/openauth' }) - }, + }) + router.push({ + path: '/redirect/iframe', + query: { + url: encodeURIComponent(`http://www.openauth.net.cn`) // 设置URL + } + }) +} ```