吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 863|回复: 5
收起左侧

[求助] element ui请教

[复制链接]
ppgjx 发表于 2022-12-11 00:37
[Asm] 纯文本查看 复制代码
<template>
        <el-container style="height: 100%;"  >
            <el-header style="background-color: white;height: 80px" class="brd">
                <div>
                   <el-avatar size="large" :src="avatarURL"></el-avatar>
                    <span style="color: black">测试系统</span>
                </div>
            </el-header>

            <el-container class="brd" style="margin-top: 2px">
                <el-aside width="230px" style="background-color: white" class="brd">

                    <el-menu
                            unique-opened
                            router
                            default-active="/Test"
                            class="el-menu-vertical-demo"
                            >

                      <el-submenu :index="index"  v-for="(value, index) in data">
                            <template slot="title">
                                <i :class="value.icon"></i>
                                <span>{{ value.name }}</span>
                            </template>
                                <el-menu-item v-for="(value, index) in value.item" :index="value.path">{{value.name}}</el-menu-item>
                        </el-submenu>

                    </el-menu>
                </el-aside>

                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>

        </el-container>
</template>

<script>
    import avatarURL from '../assets/login.jpg'

    export default {
      name: "Home",
      methods:{
      },
        created() {

        },
        data(){
            return{
                avatarURL: avatarURL,
                data:[
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                  {icon: "el-icon-user",name: "基本操作",item: [
                      {path: "/test",name: "测试"},
                      {path: "/test1",name: "测试1"},
                      {path: "/test2",name: "测试2"},
                    ]},
                ]
            }
        }
    }
</script>

<style lang="less" scoped>
.el-header{
    background-color: #373d41;
    display: flex;
    justify-content: space-between;
    padding-left: 0;
    align-items: center;
    color: #dddddd;
    font-size: 20px;
    > div{
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        span{
            margin-left: 15px;
        }
        img{
            height: 100%;
        }
    }
}
.el-aside{
    background-color: #333744;
    .el-menu{
        border-right: none;
    }
}
.el-man{
    background-color: #eaedf1;
}

.brd{
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)
}
</style>



这是我的代码 用的vue 饿了么的ui

他是这样的 每一行都是可以下拉的

搜狗截图20221211003527.png

现在我想和下面一张图一样 和下拉菜单同一级 加一个控制台 这个控制台没有下拉按钮 点上去就是一个页面 这种该怎么加呢?对css很小白



搜狗截图20221211003422.png

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

r396517261 发表于 2022-12-11 00:57
官网上有例子 直接加一个 <el-menu-item>标题</el-menu-item> 标签就行
小丑恶人 发表于 2022-12-11 09:15
Libra_c 发表于 2022-12-11 10:01
zx2000 发表于 2022-12-12 09:58
uTools_1670810298340.png 下面的才是无下拉的,你写的全是有下拉的
iLouis 发表于 2022-12-12 22:49
本帖最后由 iLouis 于 2022-12-12 22:50 编辑

[HTML] 纯文本查看 复制代码
<el-submenu :index="index"  v-for="(value, index) in data">
    <template slot="title">
        <i :class="value.icon"></i>
        <span>{{ value.name }}</span>
    </template>
    <el-menu-item v-for="(value, index) in value.item" :index="value.path">{{value.name}}</el-menu-item>
</el-submenu>

在这上面加
[HTML] 纯文本查看 复制代码
<el-menu-item index="control">
    <i class="el-icon-menu"></i>
    <span slot="title">控制台</span>
</el-menu-item>

平级就好了
https://element.eleme.cn/#/zh-CN/component/menu
文档和示例在这
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 05:00

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表