vue點擊菜單跳轉外部頁面鏈接


1.動態菜單配置xxxxxx.vue

<template>
    <div>

    </div>
</template>

<script>
    import envs from '../../config/env'
    export default {
        data () {
            return {
            }
        },
        methods: {
        open(){
            window.location.href = 'https://element.eleme.cn/#/zh-CN';
        },

        },
        created () {
            this.open();
    }}
</script>

 

 

2.靜態菜單配置 xxxxx.vue的js配置

let menu = {
    menus: [

        {
            key: '1', desc: '菜單1', icon: 'iconxxxx',  permission: 'xxxxx', subs: [
            {key: '/aaa/bbb',  desc: '菜單11', permission: 'xxxxx'},
            {key: '/aaa/bbb',  desc: '菜單12', permission: 'xxxxx'},
            {key: '/aaa/bbb',   desc: '菜單13', permission: 'xxxxx'},
            ]
        },
        {
        // 需要跳轉的外部鏈接
            key: '/xxxxxx/outLink', desc: '外部鏈接', icon: 'iconxxxx',  permission: 'xxxxx',
        }

    ]
};

export default menu;

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

 window.location.href = 'https://element.eleme.cn/#/zh-CN'

 


免責聲明!

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



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