layuiAdmin單頁(yè)版根據(jù)后臺(tái)json數(shù)據(jù)動(dòng)態(tài)生成左側(cè)菜單欄
網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、成都小程序開(kāi)發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了涇川免費(fèi)建站歡迎大家使用!使用模板方式加載菜單
lay-url=“菜單接口”
lay-headers=“將token帶入請(qǐng)求頭”,如果沒(méi)有,去掉就行
在模板中使用console.log 示例: {{# console.log(1) }}
layui.data(‘layuiAdmin’).token 調(diào)用本地存儲(chǔ)的token,token名需要和本地存儲(chǔ)對(duì)應(yīng)
json字段名不需要和這里的一樣,json字段名改變,模板里面也要相應(yīng)的修改
后臺(tái)返回的json格式(示例)
{ "code": 0 ,"msg": "" ,"data": [{ "title": "主頁(yè)" ,"icon": "layui-icon-home" ,"list": [{ "title": "控制臺(tái)" ,"jump": "/" }, { "name": "homepage1" ,"title": "主頁(yè)一" ,"jump": "home/homepage1" }, { "name": "homepage2" ,"title": "主頁(yè)二" ,"jump": "home/homepage2" }] }, { "name": "component" ,"title": "組件" ,"icon": "layui-icon-component" ,"list": [{ "name": "grid" ,"title": "柵格" ,"list": [{ "name": "list" ,"title": "等比例列表排列" },{ "name": "mobile" ,"title": "按移動(dòng)端排列" },{ "name": "mobile-pc" ,"title": "移動(dòng)桌面端組合" },{ "name": "all" ,"title": "全端復(fù)雜組合" },{ "name": "stack" ,"title": "低于桌面堆疊排列" },{ "name": "speed-dial" ,"title": "九宮格" }] }, { "name": "button" ,"title": "按鈕" }, { "name": "form" ,"title": "表單" ,"list": [{ "name": "element" ,"title": "表單元素" },{ "name": "group" ,"title": "表單組合" }] }, { "name": "nav" ,"title": "導(dǎo)航" }, { "name": "tabs" ,"title": "選項(xiàng)卡" }, { "name": "progress" ,"title": "進(jìn)度條" }, { "name": "panel" ,"title": "面板" }, { "name": "badge" ,"title": "徽章" }, { "name": "timeline" ,"title": "時(shí)間線" }, { "name": "anim" ,"title": "動(dòng)畫(huà)" }, { "name": "auxiliar" ,"title": "輔助" }, { "name": "layer" ,"title": "通用彈層" ,"list": [{ "name": "list" ,"title": "功能演示" },{ "name": "special-demo" ,"title": "特殊示例" },{ "name": "theme" ,"title": "風(fēng)格定制" }] }, { "name": "laydate" ,"title": "日期時(shí)間" ,"list": [{ "name": "demo1" ,"title": "功能演示一" },{ "name": "demo2" ,"title": "功能演示二" },{ "name": "theme" ,"title": "設(shè)定主題" },{ "name": "special-demo" ,"title": "特殊示例" }] }, { "name": "table" ,"title": "表格" ,"list": [{ "name": "simple" ,"title": "簡(jiǎn)單數(shù)據(jù)表格" },{ "name": "auto" ,"title": "列寬自動(dòng)分配" },{ "name": "data" ,"title": "賦值已知數(shù)據(jù)" },{ "name": "tostatic" ,"title": "轉(zhuǎn)化靜態(tài)表格" },{ "name": "page" ,"title": "開(kāi)啟分頁(yè)" },{ "name": "resetPage" ,"title": "自定義分頁(yè)" },{ "name": "toolbar" ,"title": "開(kāi)啟頭部工具欄" },{ "name": "totalRow" ,"title": "開(kāi)啟合計(jì)行" },{ "name": "height" ,"title": "高度大適應(yīng)" },{ "name": "checkbox" ,"title": "開(kāi)啟復(fù)選框" },{ "name": "radio" ,"title": "開(kāi)啟單選框" },{ "name": "cellEdit" ,"title": "開(kāi)啟單元格編輯" },{ "name": "form" ,"title": "加入表單元素" },{ "name": "style" ,"title": "設(shè)置單元格樣式" },{ "name": "fixed" ,"title": "固定列" },{ "name": "operate" ,"title": "數(shù)據(jù)操作" },{ "name": "parseData" ,"title": "解析任意數(shù)據(jù)格式" },{ "name": "onrow" ,"title": "監(jiān)聽(tīng)行事件" },{ "name": "reload" ,"title": "數(shù)據(jù)表格的重載" },{ "name": "initSort" ,"title": "設(shè)置初始排序" },{ "name": "cellEvent" ,"title": "監(jiān)聽(tīng)單元格事件" },{ "name": "thead" ,"title": "復(fù)雜表頭" }] }, { "name": "laypage" ,"title": "分頁(yè)" ,"list": [{ "name": "demo1" ,"title": "功能演示一" },{ "name": "demo2" ,"title": "功能演示二" }] }, { "name": "upload" ,"title": "上傳" ,"list": [{ "name": "demo1" ,"title": "功能演示一" },{ "name": "demo2" ,"title": "功能演示二" }] }, { "name": "colorpicker" ,"title": "顏色選擇器" }, { "name": "slider" ,"title": "滑塊組件" }, { "name": "rate" ,"title": "評(píng)分" }, { "name": "carousel" ,"title": "輪播" }, { "name": "flow" ,"title": "流加載" }, { "name": "util" ,"title": "工具" }, { "name": "code" ,"title": "代碼修飾" }, { "name": "layim" ,"title": "即時(shí)聊天" ,"jump": "senior/im/" }] }, { "name": "template" ,"title": "頁(yè)面" ,"icon": "layui-icon-template" ,"list": [{ "name": "personalpage" ,"title": "個(gè)人主頁(yè)" ,"jump": "template/personalpage" },{ "name": "addresslist" ,"title": "通訊錄" ,"jump": "template/addresslist" },{ "name": "caller" ,"title": "客戶列表" ,"jump": "template/caller" },{ "name": "goodslist" ,"title": "商品列表" ,"jump": "template/goodslist" },{ "name": "msgboard" ,"title": "留言板" ,"jump": "template/msgboard" },{ "name": "search" ,"title": "搜索結(jié)果" ,"jump": "template/search" },{ "name": "reg" ,"title": "注冊(cè)" ,"jump": "user/reg" },{ "name": "login" ,"title": "登入" ,"jump": "user/login" },{ "name": "forget" ,"title": "忘記密碼" ,"jump": "user/forget" },{ "name": "404" ,"title": "404" ,"jump": "template/tips/404" },{ "name": "error" ,"title": "錯(cuò)誤提示" ,"jump": "template/tips/error" }, { "name": "" ,"title": "內(nèi)嵌頁(yè)面" ,"spread": true ,"list": [{ "name": "" ,"title": "百度一下" ,"jump": "/iframe/link/baidu" }, { "name": "" ,"title": "layui官網(wǎng)" ,"jump": "/iframe/link/layui" }, { "name": "" ,"title": "layuiAdmin官網(wǎng)" ,"jump": "/iframe/link/layuiAdmin" }] }] }, { "name": "app" ,"title": "應(yīng)用" ,"icon": "layui-icon-app" ,"list": [{ "name": "content" ,"title": "內(nèi)容系統(tǒng)" ,"list": [{ "name": "list" ,"title": "文章列表" },{ "name": "tags" ,"title": "分類管理" },{ "name": "comment" ,"title": "評(píng)論管理" }] },{ "name": "forum" ,"title": "社區(qū)系統(tǒng)" ,"list": [{ "name": "list" ,"title": "帖子列表" },{ "name": "replys" ,"title": "回帖列表" }] },{ "name": "message" ,"title": "消息中心" },{ "name": "workorder" ,"title": "工單系統(tǒng)" ,"jump": "app/workorder/list" }] }, { "name": "senior" ,"title": "高級(jí)" ,"icon": "layui-icon-senior" ,"list": [{ "name": "im" ,"title": "通訊系統(tǒng)" },{ "name": "echarts" ,"title": "Echarts集成" ,"list": [{ "name": "line" ,"title": "折線圖" },{ "name": "bar" ,"title": "柱狀圖" },{ "name": "map" ,"title": "地圖" }] }] }, { "name": "user" ,"title": "用戶" ,"icon": "layui-icon-user" ,"list": [{ "name": "user" ,"title": "網(wǎng)站用戶" ,"jump": "user/user/list" }, { "name": "administrators-list" ,"title": "后臺(tái)管理員" ,"jump": "user/administrators/list" }, { "name": "administrators-rule" ,"title": "角色管理" ,"jump": "user/administrators/role" }] }, { "name": "set" ,"title": "設(shè)置" ,"icon": "layui-icon-set" ,"list": [{ "name": "system" ,"title": "系統(tǒng)設(shè)置" ,"spread": true ,"list": [{ "name": "website" ,"title": "網(wǎng)站設(shè)置" },{ "name": "email" ,"title": "郵件服務(wù)" }] },{ "name": "user" ,"title": "我的設(shè)置" ,"spread": true ,"list": [{ "name": "info" ,"title": "基本資料" },{ "name": "password" ,"title": "修改密碼" }] }] }, { "name": "get" ,"title": "授權(quán)" ,"icon": "layui-icon-auz" ,"jump": "system/get" }] }
效果圖:
以上就是詳解layuiAdmin單頁(yè)版根據(jù)后臺(tái)json數(shù)據(jù)動(dòng)態(tài)生成左側(cè)菜單欄的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司其它相關(guān)文章!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。