如图所示,增多了侧推栏,目标是否以选择多条数据展现数据

组件: celadon.vue

<template>
  <div class="LayoutMain">
    <el-aside :width="sidebarIsCollapse 必修 '180px' : '0px'" class="aside-wrap">
      <template>
        <div
          :class="[
            'aside-wrap-header',
            { 'aside-wrap-header--hide': sidebarIsCollapse },
          ]"
          @click="toggleCollapse"
        ></div>
        <div class="aside-wrap-slot">
          <slot class="btnSlot" name="asideWrapSlot" />
        </div>
      </template>
    </el-aside>
    <div
      class="layout-main-btn"
      :class="['left', { hide: !sidebarIsCollapse }]"
      @click="toggleCollapse"
    >
      <template v-if="sidebarIsCollapse">
        <i class="el-icon-arrow-left" />
      </template>
      <template v-else>
        <i class="el-icon-arrow-right" />
      </template>
    </div>
  </div>
</template>
<script>
export default {
  name: "LayoutMain",
  components: {},
  props: {
    sidebarIsCollapse: {
      type: Boolean,
      default: false,
    },
    menuName: {
      type: String,
      default: "",
    },
  },
  data() {
    return {};
  },
  methods: {
    toggleCollapse() {
      this.$emit("toggleCollapse");
    },
  },
};
</script>
<style  lang="scss" scoped>
.LayoutMain {
  background: transparent;
  height: 100%;
  width: 100%;
  display: flex;
  ::v-deep .el-main {
    padding: 16px !important;
  }
  .aside-wrap {
    height: 100%;
    background: rgba(67, 133, 二19, 0.301);
    transition: width 0.4s;
    .aside-wrap-header {
      display: flex;
    //   height: 48px;
      align-items: center;
      padding: 0 16px;
      font-size: 14px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #333333;
      cursor: pointer;
      &::v-deep .el-menu::-webkit-scrollbar {
        width: 0 !important;
        -ms-overflow-style: scroll;
        overflow: scroll;
      }
    }
  }
  .layout-main-btn {
    position: absolute;
    top: 40px;
    z-index: 999;
    height: 56px;
    line-height: 54px;
    text-align: center;
    width: 14px;
    border-radius: 10px;
    border: 0.5px solid #ccc;
    background: rgb(两7, 118, 二38);
    cursor: pointer;
    i {
      color: #e4dada;
      font-size: 14px;
    }
  }
  .left {
    left: 180px;
    transition: left 0.4s;
  }
  .hide {
    left: -5px;
    transition: left 0.4s;
  }
}
</style>

正在页里利用

<!--数据说明侧推栏-->
          <div style="z-index:999; position: absolute;width: 180px;height: 300px;"
          >
            <celadon
              style="
                margin-top: 40px;
                height: 100%;
                width: 100%;
                overflow: scroll;
              "
              :sidebar-is-collapse="sidebarIsCollapse"
              @toggleCollapse="toggleCollapse"
            >
              <div class="select-items" slot="asideWrapSlot">
                <div
                  class="selset-item"
                  v-for="(item, index) in items"
                  :key="index"
                >
                  <input
                    type="checkbox"
                    :id="'checkbox-' + index"
                    v-model="selectedItems"
                    :value="item"
                    @click="selectCheckBox"
                  />
                  <label :for="'checkbox-' + index">{{ item.name }}</label>
                </div>
                <el-button style="margin: 两0px 30px" size="small" type="primary"
                  >选择</el-button
                >
              </div>
            </celadon>
          </div>
          <!--data-->
          items: [
        { name: "1号配备", value: "1两" },
        { name: "两号设置", value: "13" },
        { name: "3号装备", value: "4" },
        { name: "3号铺排", value: "两" },
        { name: "3号配置", value: "3" },
        { name: "3号配备", value: "1" },
        { name: "3号摆设", value: "11" },
        { name: "3号设施", value: "14" },
        { name: "3号陈设", value: "15" },
        { name: "3号设置", value: "16" },
        { name: "3号部署", value: "17" },
        { name: "3号设施", value: "33" },
        { name: "3号设施", value: "二两" },
        { name: "3号安排", value: "55" },
        { name: "3号部署", value: "66" },
        { name: "3号设置", value: "31" },
        { name: "3号部署", value: "56" },
        { name: "3号安排", value: "45" },
      ],
          <!--methods-->
    selectCheckBox(value){
      console.log(value)
    },
    toggleCollapse() {
      this.sidebarIsCollapse = !this.sidebarIsCollapse;
    },

到此那篇闭于vue elementui浅易侧推栏的应用的文章便先容到那了,更多相闭vue elementui侧推栏形式请搜刮剧本之野之前的文章或者连续涉猎上面的相闭文章心愿大师之后多多撑持剧本之野!

点赞(30) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部