mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 10:24:44 +08:00
docs: 完善打开外部站点文档
This commit is contained in:
@@ -2,21 +2,25 @@
|
|||||||
|
|
||||||
上一章节通过添加模块或直接在路由表中添加固定路由实现路由控制。在有些场景下,需要代码中直接打开一个外部指定URL的地址(不通过系统的【模块管理】功能添加到导航栏),如下图:
|
上一章节通过添加模块或直接在路由表中添加固定路由实现路由控制。在有些场景下,需要代码中直接打开一个外部指定URL的地址(不通过系统的【模块管理】功能添加到导航栏),如下图:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
可以直接使用下面代码实现:
|
可以直接使用下面代码实现:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openUrl() {
|
const openUrl = () => {
|
||||||
let obj = {}
|
const routes = router.getRoutes()
|
||||||
obj['openauth'] = { //这里的openauth可以改成你希望在浏览器地址栏中看到的url
|
routes.forEach(route => {
|
||||||
name: '官网',
|
if (route.path === '/redirect/iframe') {
|
||||||
url: 'http://www.openauth.net.cn',
|
route.meta.title = 'OpenAuth.Net官网' // 设置标题
|
||||||
}
|
}
|
||||||
this.$store.dispatch('setIframeTagViews', obj, { root: true })
|
})
|
||||||
|
router.push({
|
||||||
this.$router.push({ path: '/iframePage/openauth' })
|
path: '/redirect/iframe',
|
||||||
},
|
query: {
|
||||||
|
url: encodeURIComponent(`http://www.openauth.net.cn`) // 设置URL
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user