国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸

這篇具有很好參考價值的文章主要介紹了Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

在home.view中添加代碼

Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸,vue.js,javascript,前端

<template>
  <div>
    <div class="common-layout">
      <el-container>
        <el-header class="common-header flex-float">
          <div class="flex">
            <img class="logo" src="../assets/logo.png" alt="" />
            <h1 class="title">商鋪后臺管理系統(tǒng)</h1>
          </div>

          <el-button type="danger">退出</el-button>
        </el-header>
        <el-container>
          <!-- 側(cè)邊欄 -->
          <el-aside class="common-aside" width="200px">
            <!-- 菜單 -->
            <el-menu background-color="none" text-color="#fff" :router="true">
              <testItem v-for="menu in menuList" :menu="menu" :key="menu.id" :index="menu.id+''"></testItem>
            </el-menu>
          </el-aside>
          <el-main><router-view></router-view></el-main>
        </el-container>
      </el-container>
    </div>
  </div>
</template>
<script setup>
import { reactive } from 'vue'
let menuList = reactive([
  {
    authname: "隨便管理",
    id: 1,
    children: [

    ]
  },
  {
    authname: "用戶管理",
    id: 2,
    children: [
      {
        authname: "二級用戶1",
        id: 12,
        children: []
      },
      {
        authname: "二級用戶2",
        id: 13,
        children: [
          {
            id: 14,
            authname: "三級用戶1"
          }
        ]
      }
    ]
  },
  {
    authname: "訂單管理",
    id: 3,
    children: [
      {
        authname: "二級訂單1",
        id: 15,
        children: []
      },
      {
        authname: "二級訂單2",
        id: 16,
        children: [
          {
            id: 17,
            authname: "三級訂單1",
            children:[
              {
                id:18,
                authname:"四級",
                children:[
                 {
                  id:20,
                  authname:"五級",
                  children:[]
                 }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
])
</script>
<style >
.el-container {
  height: 100vh;
  overflow: hidden;
}

.common-header {
  background: rgb(63 67 72);
}

.common-aside {
  background: rgb(48, 55, 65);
}

.logo {
  width: 60px;
}

.title {
  color: #fff;
}
</style>

?2 創(chuàng)建一個全局組件

Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸,vue.js,javascript,前端

<template lang="">
         
        <el-menu-item :index="menu.id+''"  v-if="!menu.children || menu.children.length == 0" >
            <image src="../assets/logo.png" style="width:30px;height:30px;"/>
            <span>{{ menu.authname }}</span>
        </el-menu-item>
        <el-sub-menu v-else >
                <template #title>
                    <image src="../assets/logo.png" style="width:30px;height:30px;"/>
                  <span>{{ menu.authname }}</span>
                </template>
               
                <!-- 二級菜單 -->
            <el-menu-item-group v-if=" menu.children&& menu.children.length>0">
                <testItem  v-for="item in menu.children" :key="item.id" :index="item.id+''" :menu="item"></testItem>
            </el-menu-item-group>
            <testItem v-else  v-for="item in menu.children" :key="item.id" :index="item.id+''" :menu="item"></testItem>
            
        </el-sub-menu>

    
</template>

<script>

export default {
    name: 'testItem',
    props: {
        menu: Object
    }
}
</script>


<style lang="">
    
</style>

?效果如圖

Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸,vue.js,javascript,前端文章來源地址http://www.zghlxwxcb.cn/news/detail-699703.html

到了這里,關(guān)于Vue3后臺管理系統(tǒng)Element-plus_側(cè)邊欄制作_無限遞歸的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包