9.21总结

一、修改element-ui的图标颜色

        修改图标元素颜色(大部分的元素不允许修改,添加!important )

.layout-aside i{ color: #42b983 !important; }

二、下拉菜单默认选中

        $router.currentRoute.path,获取配置路径,currentRoute当前对象,调用对象中的路径

        :default-active="$router.currentRoute.path"

三、下拉菜单中index可以添加router的path路径

        <el-menu-item index="/sys-admin/temp/brand/add-new"><i class="el-icon-circle-plus"></i>添加品牌</el-menu-item>

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
        /*添加子元素显示*/
        children: [
            {
                path: '/sys-admin/temp/album/add-new',
                component: () => import('../views/sys-admin/temp/AlbumAddNew.vue')
            },
            {
                path: '/sys-admin/temp/brand/add-new',
                component: () => import('../views/sys-admin/temp/BrandAddNew.vue')
            },
        ]
    },
]

四、在vue中实现组件拼接显示页面 

vue页面      
        <!-- 主体 -->
        <el-main class="layout-main">
         <router-view></router-view>
        </el-main>

router配置文件

 path: '/',
        name: 'home',
        component: HomeView,
        /*添加子元素显示*/
        children: [
            {
                path: '/sys-admin/temp/album/add-new',
                component: () => import('../views/sys-admin/temp/AlbumAddNew.vue')
            },
            {
                path: '/sys-admin/temp/brand/add-new',
                component: () => import('../views/sys-admin/temp/BrandAddNew.vue')
            },
        ]

        在vue中添加视图组件,需要添加标签 <router-view></router-view>,并添加子元素。在vue中,只有一个页面,所有的页面变化都是在不断的调用其他组件在此唯一页面上变换显示,index="/sys-admin/temp/brand/add-new" index实际功能为跳转页面,但是在router的index配置中,添加了子元素,所以点击不会跳转页面,而是会在 <router-view></router-view>里显示。

        未在path添加路径,会直接跳转到App.vue的 <router-view></router-view>

         在path中添加路径,会直接跳转到HomeView.vue的 <router-view></router-view>        

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值