zoukankan      html  css  js  c++  java
  • ElementUI 侧边栏伸缩布局

    ElementUI 侧边栏伸缩布局
    <template>
      <div id="home">
        <el-container>
          <el-aside width="auto">
            <div class="logo"></div>
            <el-menu class="el-menu-vertical-demo" collapse-transition="true" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span slot="title">导航一</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item>
                    <i class="el-icon-location"></i>
                    <span slot="title">选项1</span>
                    </el-menu-item>
                    <el-menu-item>
                    <i class="el-icon-location"></i>
                    <span slot="title">选项2</span>
                    </el-menu-item>
                </el-menu-item-group>
              </el-submenu>
            </el-menu>
          </el-aside>
          <el-container>
            <el-header>
              <i class="el-icon-location toggle" @click="toggleCollapse"></i>
            </el-header>
            <el-main>Main</el-main>
          </el-container>
        </el-container>
      </div>
    </template>
    <script>
    export default {
      data() {
        return {
          isCollapse: true
        };
      },
      methods: {
        handleOpen (key, keyPath) {
          console.log(key, keyPath)
        },
        handleClose (key, keyPath) {
          console.log(key, keyPath)
        },
        toggleCollapse () {
          console.log(123456789);
          
          this.isCollapse = !this.isCollapse
        }
      }
    }
    </script>
    <style lang="scss" scoped>
      #home {
         100%;
        height: 100%;
        .el-menu-admin:not(.el-menu--collapse) {
           200px;
          min-height: 400px;
        }
        .el-container {
          height: 100%;
        }
        .el-aside {
          background-color: #545c64;
        }
        .el-header {
          background-color: #fe4;
        }
        .el-main {
          background-color: #f20;
        }
        .toggle {
          font-size: 36px;
          color: #989898;
          cursor: pointer;
          line-height: 30px;
        }
     
      }
      
    </style>
    
    请用今天的努力,让明天没有遗憾。
  • 相关阅读:
    怎样整理房间
    拙劣的外部变量
    鸡窝里飞出伪凤凰
    flag标志什么?哦,它标志代码馊了——(三)
    边界测试——让BUG现形
    static的滥用与变态的阉割
    无知乱吃药
    flag标志什么?哦,它标志代码馊了——(一)
    flag标志什么?哦,它标志代码馊了——(二)
    半身不遂和粗中有细
  • 原文地址:https://www.cnblogs.com/cupid10/p/13820890.html
Copyright © 2011-2022 走看看