vue 點擊菜單跳轉外部頁面


主要使用 以下方式跳轉外部頁面,通過路由到指定頁面后,再打開外部頁面

1 window.location.href = 'http://www.baidu.com'

 

修改如下:

1.菜單配置 menu.js:

 1 let menu = {
 2     menus: [
 3 
 4         {
 5             key: '1', desc: '菜單1', icon: 'iconxxxx',  permission: 'xxxxx', subs: [
 6             {key: '/aaa/bbb',  desc: '菜單11', permission: 'xxxxx'},
 7             {key: '/aaa/bbb',  desc: '菜單12', permission: 'xxxxx'},
 8             {key: '/aaa/bbb',   desc: '菜單13', permission: 'xxxxx'},
 9             ]
10         },
11         {
12         // 需要跳轉的外部鏈接
13             key: '/xxxxxx/outLink', desc: '外部鏈接', icon: 'iconxxxx',  permission: 'xxxxx',
14         }
15 
16     ]
17 };
18 
19 export default menu;

 

2.outLink.vue

 1 <template>
 2     <div>
 3 
 4     </div>
 5 </template>
 6 
 7 <script>
 8     import envs from '../../config/env'
 9     export default {
10         data () {
11             return {
12             }
13         },
14         methods: {
15         open(){
16             window.location.href = 'http://www.baidu.com';
17         },
18 
19         },
20         created () {
21             this.open();
22     }}
23 </script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM