diff --git a/README.md b/README.md index 7021d2d..1ad6bba 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,16 @@ -# [LayuiAdmin iframe标准版(v2.3.2)](https://layui.gitee.io/v2/themes/layuiAdmin/2.0/iframe/views/) +# layui-admin -## 通过[./src/views/index.html](./src/views/index.html)进行预览 ++ layui-admin v2.3.2 ++ layui v2.9.3 -## 文档地址:[docs/docs.html](./docs/docs.html) +## `iframe`下为iframe版的layui-admin,`docs`中为文档 + +iframe版在线预览:https://layui.gitee.io/v2/themes/layuiAdmin/2.0/iframe/views/ + +入口:[index.html](iframe%2Fsrc%2Fviews%2Findex.html) + +## `single`下为单页应用的layui-admin,`docs`中为文档 + +单页版在线预览:https://layui.gitee.io/v2/themes/layuiAdmin/2.0/single/ + +入口:[index.html](single%2Findex.html) diff --git a/docs/docs.html b/iframe/docs/docs.html similarity index 100% rename from docs/docs.html rename to iframe/docs/docs.html diff --git a/docs/static/dist/dev/css/docs.css b/iframe/docs/static/dist/dev/css/docs.css similarity index 100% rename from docs/static/dist/dev/css/docs.css rename to iframe/docs/static/dist/dev/css/docs.css diff --git a/docs/static/dist/dev/css/index.css b/iframe/docs/static/dist/dev/css/index.css similarity index 100% rename from docs/static/dist/dev/css/index.css rename to iframe/docs/static/dist/dev/css/index.css diff --git a/docs/static/dist/dev/modules/docs.js b/iframe/docs/static/dist/dev/modules/docs.js similarity index 100% rename from docs/static/dist/dev/modules/docs.js rename to iframe/docs/static/dist/dev/modules/docs.js diff --git a/docs/static/dist/dev/modules/face.js b/iframe/docs/static/dist/dev/modules/face.js similarity index 100% rename from docs/static/dist/dev/modules/face.js rename to iframe/docs/static/dist/dev/modules/face.js diff --git a/docs/static/dist/dev/modules/index.js b/iframe/docs/static/dist/dev/modules/index.js similarity index 100% rename from docs/static/dist/dev/modules/index.js rename to iframe/docs/static/dist/dev/modules/index.js diff --git a/docs/static/dist/docs/2.7/css/global.css b/iframe/docs/static/dist/docs/2.7/css/global.css similarity index 100% rename from docs/static/dist/docs/2.7/css/global.css rename to iframe/docs/static/dist/docs/2.7/css/global.css diff --git a/docs/static/images/dev/logo.png b/iframe/docs/static/images/dev/logo.png similarity index 100% rename from docs/static/images/dev/logo.png rename to iframe/docs/static/images/dev/logo.png diff --git a/src/res/adminui/dist/css/admin.css b/iframe/src/res/adminui/dist/css/admin.css similarity index 100% rename from src/res/adminui/dist/css/admin.css rename to iframe/src/res/adminui/dist/css/admin.css diff --git a/src/res/adminui/dist/css/login.css b/iframe/src/res/adminui/dist/css/login.css similarity index 100% rename from src/res/adminui/dist/css/login.css rename to iframe/src/res/adminui/dist/css/login.css diff --git a/src/res/adminui/dist/modules/admin.js b/iframe/src/res/adminui/dist/modules/admin.js similarity index 100% rename from src/res/adminui/dist/modules/admin.js rename to iframe/src/res/adminui/dist/modules/admin.js diff --git a/src/res/adminui/dist/modules/index.js b/iframe/src/res/adminui/dist/modules/index.js similarity index 100% rename from src/res/adminui/dist/modules/index.js rename to iframe/src/res/adminui/dist/modules/index.js diff --git a/src/res/adminui/dist/modules/view.js b/iframe/src/res/adminui/dist/modules/view.js similarity index 100% rename from src/res/adminui/dist/modules/view.js rename to iframe/src/res/adminui/dist/modules/view.js diff --git a/src/res/config.js b/iframe/src/res/config.js similarity index 100% rename from src/res/config.js rename to iframe/src/res/config.js diff --git a/src/res/index.js b/iframe/src/res/index.js similarity index 100% rename from src/res/index.js rename to iframe/src/res/index.js diff --git a/src/res/json/console/prograss.js b/iframe/src/res/json/console/prograss.js similarity index 100% rename from src/res/json/console/prograss.js rename to iframe/src/res/json/console/prograss.js diff --git a/src/res/json/console/top-card.js b/iframe/src/res/json/console/top-card.js similarity index 100% rename from src/res/json/console/top-card.js rename to iframe/src/res/json/console/top-card.js diff --git a/src/res/json/console/top-search.js b/iframe/src/res/json/console/top-search.js similarity index 100% rename from src/res/json/console/top-search.js rename to iframe/src/res/json/console/top-search.js diff --git a/src/res/json/content/comment.js b/iframe/src/res/json/content/comment.js similarity index 100% rename from src/res/json/content/comment.js rename to iframe/src/res/json/content/comment.js diff --git a/src/res/json/content/list.js b/iframe/src/res/json/content/list.js similarity index 100% rename from src/res/json/content/list.js rename to iframe/src/res/json/content/list.js diff --git a/src/res/json/content/tags.js b/iframe/src/res/json/content/tags.js similarity index 100% rename from src/res/json/content/tags.js rename to iframe/src/res/json/content/tags.js diff --git a/src/res/json/forum/list.js b/iframe/src/res/json/forum/list.js similarity index 100% rename from src/res/json/forum/list.js rename to iframe/src/res/json/forum/list.js diff --git a/src/res/json/forum/replys.js b/iframe/src/res/json/forum/replys.js similarity index 100% rename from src/res/json/forum/replys.js rename to iframe/src/res/json/forum/replys.js diff --git a/src/res/json/layim/getList.js b/iframe/src/res/json/layim/getList.js similarity index 100% rename from src/res/json/layim/getList.js rename to iframe/src/res/json/layim/getList.js diff --git a/src/res/json/message/all.js b/iframe/src/res/json/message/all.js similarity index 100% rename from src/res/json/message/all.js rename to iframe/src/res/json/message/all.js diff --git a/src/res/json/message/direct.js b/iframe/src/res/json/message/direct.js similarity index 100% rename from src/res/json/message/direct.js rename to iframe/src/res/json/message/direct.js diff --git a/src/res/json/message/notice.js b/iframe/src/res/json/message/notice.js similarity index 100% rename from src/res/json/message/notice.js rename to iframe/src/res/json/message/notice.js diff --git a/src/res/json/table/demo.js b/iframe/src/res/json/table/demo.js similarity index 100% rename from src/res/json/table/demo.js rename to iframe/src/res/json/table/demo.js diff --git a/src/res/json/table/demo2.js b/iframe/src/res/json/table/demo2.js similarity index 100% rename from src/res/json/table/demo2.js rename to iframe/src/res/json/table/demo2.js diff --git a/src/res/json/table/demo3.js b/iframe/src/res/json/table/demo3.js similarity index 100% rename from src/res/json/table/demo3.js rename to iframe/src/res/json/table/demo3.js diff --git a/src/res/json/table/user.js b/iframe/src/res/json/table/user.js similarity index 100% rename from src/res/json/table/user.js rename to iframe/src/res/json/table/user.js diff --git a/src/res/json/treeTable/demo-1.json b/iframe/src/res/json/treeTable/demo-1.json similarity index 100% rename from src/res/json/treeTable/demo-1.json rename to iframe/src/res/json/treeTable/demo-1.json diff --git a/src/res/json/user/login.js b/iframe/src/res/json/user/login.js similarity index 100% rename from src/res/json/user/login.js rename to iframe/src/res/json/user/login.js diff --git a/src/res/json/user/logout.js b/iframe/src/res/json/user/logout.js similarity index 100% rename from src/res/json/user/logout.js rename to iframe/src/res/json/user/logout.js diff --git a/src/res/json/useradmin/mangadmin.js b/iframe/src/res/json/useradmin/mangadmin.js similarity index 100% rename from src/res/json/useradmin/mangadmin.js rename to iframe/src/res/json/useradmin/mangadmin.js diff --git a/src/res/json/useradmin/role.js b/iframe/src/res/json/useradmin/role.js similarity index 100% rename from src/res/json/useradmin/role.js rename to iframe/src/res/json/useradmin/role.js diff --git a/src/res/json/useradmin/webuser.js b/iframe/src/res/json/useradmin/webuser.js similarity index 100% rename from src/res/json/useradmin/webuser.js rename to iframe/src/res/json/useradmin/webuser.js diff --git a/src/res/json/workorder/demo.js b/iframe/src/res/json/workorder/demo.js similarity index 100% rename from src/res/json/workorder/demo.js rename to iframe/src/res/json/workorder/demo.js diff --git a/src/res/layui/css/layui.css b/iframe/src/res/layui/css/layui.css similarity index 100% rename from src/res/layui/css/layui.css rename to iframe/src/res/layui/css/layui.css diff --git a/src/res/layui/font/iconfont.eot b/iframe/src/res/layui/font/iconfont.eot similarity index 100% rename from src/res/layui/font/iconfont.eot rename to iframe/src/res/layui/font/iconfont.eot diff --git a/src/res/layui/font/iconfont.svg b/iframe/src/res/layui/font/iconfont.svg similarity index 100% rename from src/res/layui/font/iconfont.svg rename to iframe/src/res/layui/font/iconfont.svg diff --git a/src/res/layui/font/iconfont.ttf b/iframe/src/res/layui/font/iconfont.ttf similarity index 100% rename from src/res/layui/font/iconfont.ttf rename to iframe/src/res/layui/font/iconfont.ttf diff --git a/src/res/layui/font/iconfont.woff b/iframe/src/res/layui/font/iconfont.woff similarity index 100% rename from src/res/layui/font/iconfont.woff rename to iframe/src/res/layui/font/iconfont.woff diff --git a/src/res/layui/font/iconfont.woff2 b/iframe/src/res/layui/font/iconfont.woff2 similarity index 100% rename from src/res/layui/font/iconfont.woff2 rename to iframe/src/res/layui/font/iconfont.woff2 diff --git a/src/res/layui/layui.js b/iframe/src/res/layui/layui.js similarity index 100% rename from src/res/layui/layui.js rename to iframe/src/res/layui/layui.js diff --git a/src/res/modules/common.js b/iframe/src/res/modules/common.js similarity index 100% rename from src/res/modules/common.js rename to iframe/src/res/modules/common.js diff --git a/src/res/modules/console.js b/iframe/src/res/modules/console.js similarity index 100% rename from src/res/modules/console.js rename to iframe/src/res/modules/console.js diff --git a/src/res/modules/contlist.js b/iframe/src/res/modules/contlist.js similarity index 100% rename from src/res/modules/contlist.js rename to iframe/src/res/modules/contlist.js diff --git a/src/res/modules/echarts.js b/iframe/src/res/modules/echarts.js similarity index 100% rename from src/res/modules/echarts.js rename to iframe/src/res/modules/echarts.js diff --git a/src/res/modules/echartsTheme.js b/iframe/src/res/modules/echartsTheme.js similarity index 100% rename from src/res/modules/echartsTheme.js rename to iframe/src/res/modules/echartsTheme.js diff --git a/src/res/modules/forum.js b/iframe/src/res/modules/forum.js similarity index 100% rename from src/res/modules/forum.js rename to iframe/src/res/modules/forum.js diff --git a/src/res/modules/layim/layim.js b/iframe/src/res/modules/layim/layim.js similarity index 100% rename from src/res/modules/layim/layim.js rename to iframe/src/res/modules/layim/layim.js diff --git a/src/res/modules/layim/res/html/find.html b/iframe/src/res/modules/layim/res/html/find.html similarity index 100% rename from src/res/modules/layim/res/html/find.html rename to iframe/src/res/modules/layim/res/html/find.html diff --git a/src/res/modules/layim/res/html/getmsg.json b/iframe/src/res/modules/layim/res/html/getmsg.json similarity index 100% rename from src/res/modules/layim/res/html/getmsg.json rename to iframe/src/res/modules/layim/res/html/getmsg.json diff --git a/src/res/modules/layim/res/html/msgbox.html b/iframe/src/res/modules/layim/res/html/msgbox.html similarity index 100% rename from src/res/modules/layim/res/html/msgbox.html rename to iframe/src/res/modules/layim/res/html/msgbox.html diff --git a/src/res/modules/layim/res/images/default.png b/iframe/src/res/modules/layim/res/images/default.png similarity index 100% rename from src/res/modules/layim/res/images/default.png rename to iframe/src/res/modules/layim/res/images/default.png diff --git a/src/res/modules/layim/res/layim.css b/iframe/src/res/modules/layim/res/layim.css similarity index 100% rename from src/res/modules/layim/res/layim.css rename to iframe/src/res/modules/layim/res/layim.css diff --git a/src/res/modules/layim/res/skin/1.jpg b/iframe/src/res/modules/layim/res/skin/1.jpg similarity index 100% rename from src/res/modules/layim/res/skin/1.jpg rename to iframe/src/res/modules/layim/res/skin/1.jpg diff --git a/src/res/modules/layim/res/skin/2.jpg b/iframe/src/res/modules/layim/res/skin/2.jpg similarity index 100% rename from src/res/modules/layim/res/skin/2.jpg rename to iframe/src/res/modules/layim/res/skin/2.jpg diff --git a/src/res/modules/layim/res/skin/3.jpg b/iframe/src/res/modules/layim/res/skin/3.jpg similarity index 100% rename from src/res/modules/layim/res/skin/3.jpg rename to iframe/src/res/modules/layim/res/skin/3.jpg diff --git a/src/res/modules/layim/res/skin/4.jpg b/iframe/src/res/modules/layim/res/skin/4.jpg similarity index 100% rename from src/res/modules/layim/res/skin/4.jpg rename to iframe/src/res/modules/layim/res/skin/4.jpg diff --git a/src/res/modules/layim/res/skin/5.jpg b/iframe/src/res/modules/layim/res/skin/5.jpg similarity index 100% rename from src/res/modules/layim/res/skin/5.jpg rename to iframe/src/res/modules/layim/res/skin/5.jpg diff --git a/src/res/modules/layim/res/voice/default.mp3 b/iframe/src/res/modules/layim/res/voice/default.mp3 similarity index 100% rename from src/res/modules/layim/res/voice/default.mp3 rename to iframe/src/res/modules/layim/res/voice/default.mp3 diff --git a/src/res/modules/message.js b/iframe/src/res/modules/message.js similarity index 100% rename from src/res/modules/message.js rename to iframe/src/res/modules/message.js diff --git a/src/res/modules/sample.js b/iframe/src/res/modules/sample.js similarity index 100% rename from src/res/modules/sample.js rename to iframe/src/res/modules/sample.js diff --git a/src/res/modules/senior.js b/iframe/src/res/modules/senior.js similarity index 100% rename from src/res/modules/senior.js rename to iframe/src/res/modules/senior.js diff --git a/src/res/modules/set.js b/iframe/src/res/modules/set.js similarity index 100% rename from src/res/modules/set.js rename to iframe/src/res/modules/set.js diff --git a/src/res/modules/user.js b/iframe/src/res/modules/user.js similarity index 100% rename from src/res/modules/user.js rename to iframe/src/res/modules/user.js diff --git a/src/res/modules/useradmin.js b/iframe/src/res/modules/useradmin.js similarity index 100% rename from src/res/modules/useradmin.js rename to iframe/src/res/modules/useradmin.js diff --git a/src/res/modules/workorder.js b/iframe/src/res/modules/workorder.js similarity index 100% rename from src/res/modules/workorder.js rename to iframe/src/res/modules/workorder.js diff --git a/src/res/style/imgs/layui-logo.jpg b/iframe/src/res/style/imgs/layui-logo.jpg similarity index 100% rename from src/res/style/imgs/layui-logo.jpg rename to iframe/src/res/style/imgs/layui-logo.jpg diff --git a/src/res/style/imgs/template/character.jpg b/iframe/src/res/style/imgs/template/character.jpg similarity index 100% rename from src/res/style/imgs/template/character.jpg rename to iframe/src/res/style/imgs/template/character.jpg diff --git a/src/res/style/imgs/template/huge.jpg b/iframe/src/res/style/imgs/template/huge.jpg similarity index 100% rename from src/res/style/imgs/template/huge.jpg rename to iframe/src/res/style/imgs/template/huge.jpg diff --git a/src/res/style/imgs/template/portrait.png b/iframe/src/res/style/imgs/template/portrait.png similarity index 100% rename from src/res/style/imgs/template/portrait.png rename to iframe/src/res/style/imgs/template/portrait.png diff --git a/src/res/style/template.css b/iframe/src/res/style/template.css similarity index 100% rename from src/res/style/template.css rename to iframe/src/res/style/template.css diff --git a/src/res/views/system/about.html b/iframe/src/res/views/system/about.html similarity index 100% rename from src/res/views/system/about.html rename to iframe/src/res/views/system/about.html diff --git a/src/res/views/system/theme.html b/iframe/src/res/views/system/theme.html similarity index 100% rename from src/res/views/system/theme.html rename to iframe/src/res/views/system/theme.html diff --git a/src/views/app/content/comment.html b/iframe/src/views/app/content/comment.html similarity index 100% rename from src/views/app/content/comment.html rename to iframe/src/views/app/content/comment.html diff --git a/src/views/app/content/list.html b/iframe/src/views/app/content/list.html similarity index 100% rename from src/views/app/content/list.html rename to iframe/src/views/app/content/list.html diff --git a/src/views/app/content/tags.html b/iframe/src/views/app/content/tags.html similarity index 100% rename from src/views/app/content/tags.html rename to iframe/src/views/app/content/tags.html diff --git a/src/views/app/forum/list.html b/iframe/src/views/app/forum/list.html similarity index 100% rename from src/views/app/forum/list.html rename to iframe/src/views/app/forum/list.html diff --git a/src/views/app/forum/replys.html b/iframe/src/views/app/forum/replys.html similarity index 100% rename from src/views/app/forum/replys.html rename to iframe/src/views/app/forum/replys.html diff --git a/src/views/app/message/index.html b/iframe/src/views/app/message/index.html similarity index 100% rename from src/views/app/message/index.html rename to iframe/src/views/app/message/index.html diff --git a/src/views/app/workorder/list.html b/iframe/src/views/app/workorder/list.html similarity index 100% rename from src/views/app/workorder/list.html rename to iframe/src/views/app/workorder/list.html diff --git a/src/views/app/workorder/listform.html b/iframe/src/views/app/workorder/listform.html similarity index 100% rename from src/views/app/workorder/listform.html rename to iframe/src/views/app/workorder/listform.html diff --git a/src/views/component/anim/index.html b/iframe/src/views/component/anim/index.html similarity index 100% rename from src/views/component/anim/index.html rename to iframe/src/views/component/anim/index.html diff --git a/src/views/component/auxiliar/index.html b/iframe/src/views/component/auxiliar/index.html similarity index 100% rename from src/views/component/auxiliar/index.html rename to iframe/src/views/component/auxiliar/index.html diff --git a/src/views/component/badge/index.html b/iframe/src/views/component/badge/index.html similarity index 100% rename from src/views/component/badge/index.html rename to iframe/src/views/component/badge/index.html diff --git a/src/views/component/button/index.html b/iframe/src/views/component/button/index.html similarity index 100% rename from src/views/component/button/index.html rename to iframe/src/views/component/button/index.html diff --git a/src/views/component/carousel/index.html b/iframe/src/views/component/carousel/index.html similarity index 100% rename from src/views/component/carousel/index.html rename to iframe/src/views/component/carousel/index.html diff --git a/src/views/component/code/index.html b/iframe/src/views/component/code/index.html similarity index 100% rename from src/views/component/code/index.html rename to iframe/src/views/component/code/index.html diff --git a/src/views/component/colorpicker/index.html b/iframe/src/views/component/colorpicker/index.html similarity index 100% rename from src/views/component/colorpicker/index.html rename to iframe/src/views/component/colorpicker/index.html diff --git a/src/views/component/dropdown/index.html b/iframe/src/views/component/dropdown/index.html similarity index 100% rename from src/views/component/dropdown/index.html rename to iframe/src/views/component/dropdown/index.html diff --git a/src/views/component/flow/index.html b/iframe/src/views/component/flow/index.html similarity index 100% rename from src/views/component/flow/index.html rename to iframe/src/views/component/flow/index.html diff --git a/src/views/component/form/element.html b/iframe/src/views/component/form/element.html similarity index 100% rename from src/views/component/form/element.html rename to iframe/src/views/component/form/element.html diff --git a/src/views/component/form/group.html b/iframe/src/views/component/form/group.html similarity index 100% rename from src/views/component/form/group.html rename to iframe/src/views/component/form/group.html diff --git a/src/views/component/grid/all.html b/iframe/src/views/component/grid/all.html similarity index 100% rename from src/views/component/grid/all.html rename to iframe/src/views/component/grid/all.html diff --git a/src/views/component/grid/list.html b/iframe/src/views/component/grid/list.html similarity index 100% rename from src/views/component/grid/list.html rename to iframe/src/views/component/grid/list.html diff --git a/src/views/component/grid/mobile-pc.html b/iframe/src/views/component/grid/mobile-pc.html similarity index 100% rename from src/views/component/grid/mobile-pc.html rename to iframe/src/views/component/grid/mobile-pc.html diff --git a/src/views/component/grid/mobile.html b/iframe/src/views/component/grid/mobile.html similarity index 100% rename from src/views/component/grid/mobile.html rename to iframe/src/views/component/grid/mobile.html diff --git a/src/views/component/grid/speed-dial.html b/iframe/src/views/component/grid/speed-dial.html similarity index 100% rename from src/views/component/grid/speed-dial.html rename to iframe/src/views/component/grid/speed-dial.html diff --git a/src/views/component/grid/stack.html b/iframe/src/views/component/grid/stack.html similarity index 100% rename from src/views/component/grid/stack.html rename to iframe/src/views/component/grid/stack.html diff --git a/src/views/component/laydate/demo1.html b/iframe/src/views/component/laydate/demo1.html similarity index 100% rename from src/views/component/laydate/demo1.html rename to iframe/src/views/component/laydate/demo1.html diff --git a/src/views/component/laydate/demo2.html b/iframe/src/views/component/laydate/demo2.html similarity index 100% rename from src/views/component/laydate/demo2.html rename to iframe/src/views/component/laydate/demo2.html diff --git a/src/views/component/laydate/special-demo.html b/iframe/src/views/component/laydate/special-demo.html similarity index 100% rename from src/views/component/laydate/special-demo.html rename to iframe/src/views/component/laydate/special-demo.html diff --git a/src/views/component/laydate/theme.html b/iframe/src/views/component/laydate/theme.html similarity index 100% rename from src/views/component/laydate/theme.html rename to iframe/src/views/component/laydate/theme.html diff --git a/src/views/component/layer/list.html b/iframe/src/views/component/layer/list.html similarity index 100% rename from src/views/component/layer/list.html rename to iframe/src/views/component/layer/list.html diff --git a/src/views/component/layer/special-demo.html b/iframe/src/views/component/layer/special-demo.html similarity index 100% rename from src/views/component/layer/special-demo.html rename to iframe/src/views/component/layer/special-demo.html diff --git a/src/views/component/layer/theme.html b/iframe/src/views/component/layer/theme.html similarity index 100% rename from src/views/component/layer/theme.html rename to iframe/src/views/component/layer/theme.html diff --git a/src/views/component/laypage/demo1.html b/iframe/src/views/component/laypage/demo1.html similarity index 100% rename from src/views/component/laypage/demo1.html rename to iframe/src/views/component/laypage/demo1.html diff --git a/src/views/component/laypage/demo2.html b/iframe/src/views/component/laypage/demo2.html similarity index 100% rename from src/views/component/laypage/demo2.html rename to iframe/src/views/component/laypage/demo2.html diff --git a/src/views/component/nav/index.html b/iframe/src/views/component/nav/index.html similarity index 100% rename from src/views/component/nav/index.html rename to iframe/src/views/component/nav/index.html diff --git a/src/views/component/panel/index.html b/iframe/src/views/component/panel/index.html similarity index 100% rename from src/views/component/panel/index.html rename to iframe/src/views/component/panel/index.html diff --git a/src/views/component/progress/index.html b/iframe/src/views/component/progress/index.html similarity index 100% rename from src/views/component/progress/index.html rename to iframe/src/views/component/progress/index.html diff --git a/src/views/component/rate/index.html b/iframe/src/views/component/rate/index.html similarity index 100% rename from src/views/component/rate/index.html rename to iframe/src/views/component/rate/index.html diff --git a/src/views/component/slider/index.html b/iframe/src/views/component/slider/index.html similarity index 100% rename from src/views/component/slider/index.html rename to iframe/src/views/component/slider/index.html diff --git a/src/views/component/table/auto.html b/iframe/src/views/component/table/auto.html similarity index 100% rename from src/views/component/table/auto.html rename to iframe/src/views/component/table/auto.html diff --git a/src/views/component/table/cellEdit.html b/iframe/src/views/component/table/cellEdit.html similarity index 100% rename from src/views/component/table/cellEdit.html rename to iframe/src/views/component/table/cellEdit.html diff --git a/src/views/component/table/cellEvent.html b/iframe/src/views/component/table/cellEvent.html similarity index 100% rename from src/views/component/table/cellEvent.html rename to iframe/src/views/component/table/cellEvent.html diff --git a/src/views/component/table/data.html b/iframe/src/views/component/table/data.html similarity index 100% rename from src/views/component/table/data.html rename to iframe/src/views/component/table/data.html diff --git a/src/views/component/table/fixed.html b/iframe/src/views/component/table/fixed.html similarity index 100% rename from src/views/component/table/fixed.html rename to iframe/src/views/component/table/fixed.html diff --git a/src/views/component/table/form.html b/iframe/src/views/component/table/form.html similarity index 100% rename from src/views/component/table/form.html rename to iframe/src/views/component/table/form.html diff --git a/src/views/component/table/index.html b/iframe/src/views/component/table/index.html similarity index 100% rename from src/views/component/table/index.html rename to iframe/src/views/component/table/index.html diff --git a/src/views/component/table/initSort.html b/iframe/src/views/component/table/initSort.html similarity index 100% rename from src/views/component/table/initSort.html rename to iframe/src/views/component/table/initSort.html diff --git a/src/views/component/table/onrow.html b/iframe/src/views/component/table/onrow.html similarity index 100% rename from src/views/component/table/onrow.html rename to iframe/src/views/component/table/onrow.html diff --git a/src/views/component/table/parseData.html b/iframe/src/views/component/table/parseData.html similarity index 100% rename from src/views/component/table/parseData.html rename to iframe/src/views/component/table/parseData.html diff --git a/src/views/component/table/radio.html b/iframe/src/views/component/table/radio.html similarity index 100% rename from src/views/component/table/radio.html rename to iframe/src/views/component/table/radio.html diff --git a/src/views/component/table/resetPage.html b/iframe/src/views/component/table/resetPage.html similarity index 100% rename from src/views/component/table/resetPage.html rename to iframe/src/views/component/table/resetPage.html diff --git a/src/views/component/table/search.html b/iframe/src/views/component/table/search.html similarity index 100% rename from src/views/component/table/search.html rename to iframe/src/views/component/table/search.html diff --git a/src/views/component/table/static.html b/iframe/src/views/component/table/static.html similarity index 100% rename from src/views/component/table/static.html rename to iframe/src/views/component/table/static.html diff --git a/src/views/component/table/style.html b/iframe/src/views/component/table/style.html similarity index 100% rename from src/views/component/table/style.html rename to iframe/src/views/component/table/style.html diff --git a/src/views/component/table/thead.html b/iframe/src/views/component/table/thead.html similarity index 100% rename from src/views/component/table/thead.html rename to iframe/src/views/component/table/thead.html diff --git a/src/views/component/table/tostatic.html b/iframe/src/views/component/table/tostatic.html similarity index 100% rename from src/views/component/table/tostatic.html rename to iframe/src/views/component/table/tostatic.html diff --git a/src/views/component/tabs/index.html b/iframe/src/views/component/tabs/index.html similarity index 100% rename from src/views/component/tabs/index.html rename to iframe/src/views/component/tabs/index.html diff --git a/src/views/component/timeline/index.html b/iframe/src/views/component/timeline/index.html similarity index 100% rename from src/views/component/timeline/index.html rename to iframe/src/views/component/timeline/index.html diff --git a/src/views/component/transfer/index.html b/iframe/src/views/component/transfer/index.html similarity index 100% rename from src/views/component/transfer/index.html rename to iframe/src/views/component/transfer/index.html diff --git a/src/views/component/tree/index.html b/iframe/src/views/component/tree/index.html similarity index 100% rename from src/views/component/tree/index.html rename to iframe/src/views/component/tree/index.html diff --git a/src/views/component/treeTable/index.html b/iframe/src/views/component/treeTable/index.html similarity index 100% rename from src/views/component/treeTable/index.html rename to iframe/src/views/component/treeTable/index.html diff --git a/src/views/component/upload/demo1.html b/iframe/src/views/component/upload/demo1.html similarity index 100% rename from src/views/component/upload/demo1.html rename to iframe/src/views/component/upload/demo1.html diff --git a/src/views/component/upload/demo2.html b/iframe/src/views/component/upload/demo2.html similarity index 100% rename from src/views/component/upload/demo2.html rename to iframe/src/views/component/upload/demo2.html diff --git a/src/views/component/upload/index.html b/iframe/src/views/component/upload/index.html similarity index 100% rename from src/views/component/upload/index.html rename to iframe/src/views/component/upload/index.html diff --git a/src/views/component/util/index.html b/iframe/src/views/component/util/index.html similarity index 100% rename from src/views/component/util/index.html rename to iframe/src/views/component/util/index.html diff --git a/src/views/home/console.html b/iframe/src/views/home/console.html similarity index 100% rename from src/views/home/console.html rename to iframe/src/views/home/console.html diff --git a/src/views/home/homepage1.html b/iframe/src/views/home/homepage1.html similarity index 100% rename from src/views/home/homepage1.html rename to iframe/src/views/home/homepage1.html diff --git a/src/views/home/homepage2.html b/iframe/src/views/home/homepage2.html similarity index 100% rename from src/views/home/homepage2.html rename to iframe/src/views/home/homepage2.html diff --git a/src/views/index.html b/iframe/src/views/index.html similarity index 100% rename from src/views/index.html rename to iframe/src/views/index.html diff --git a/src/views/senior/echarts/bar.html b/iframe/src/views/senior/echarts/bar.html similarity index 100% rename from src/views/senior/echarts/bar.html rename to iframe/src/views/senior/echarts/bar.html diff --git a/src/views/senior/echarts/line.html b/iframe/src/views/senior/echarts/line.html similarity index 100% rename from src/views/senior/echarts/line.html rename to iframe/src/views/senior/echarts/line.html diff --git a/src/views/senior/echarts/map.html b/iframe/src/views/senior/echarts/map.html similarity index 100% rename from src/views/senior/echarts/map.html rename to iframe/src/views/senior/echarts/map.html diff --git a/src/views/senior/im/index.html b/iframe/src/views/senior/im/index.html similarity index 100% rename from src/views/senior/im/index.html rename to iframe/src/views/senior/im/index.html diff --git a/src/views/set/system/email.html b/iframe/src/views/set/system/email.html similarity index 100% rename from src/views/set/system/email.html rename to iframe/src/views/set/system/email.html diff --git a/src/views/set/system/website.html b/iframe/src/views/set/system/website.html similarity index 100% rename from src/views/set/system/website.html rename to iframe/src/views/set/system/website.html diff --git a/src/views/set/user/info.html b/iframe/src/views/set/user/info.html similarity index 100% rename from src/views/set/user/info.html rename to iframe/src/views/set/user/info.html diff --git a/src/views/set/user/password.html b/iframe/src/views/set/user/password.html similarity index 100% rename from src/views/set/user/password.html rename to iframe/src/views/set/user/password.html diff --git a/src/views/template/addresslist.html b/iframe/src/views/template/addresslist.html similarity index 100% rename from src/views/template/addresslist.html rename to iframe/src/views/template/addresslist.html diff --git a/src/views/template/caller.html b/iframe/src/views/template/caller.html similarity index 100% rename from src/views/template/caller.html rename to iframe/src/views/template/caller.html diff --git a/src/views/template/goodslist.html b/iframe/src/views/template/goodslist.html similarity index 100% rename from src/views/template/goodslist.html rename to iframe/src/views/template/goodslist.html diff --git a/src/views/template/msgboard.html b/iframe/src/views/template/msgboard.html similarity index 100% rename from src/views/template/msgboard.html rename to iframe/src/views/template/msgboard.html diff --git a/src/views/template/personalpage.html b/iframe/src/views/template/personalpage.html similarity index 100% rename from src/views/template/personalpage.html rename to iframe/src/views/template/personalpage.html diff --git a/src/views/template/search.html b/iframe/src/views/template/search.html similarity index 100% rename from src/views/template/search.html rename to iframe/src/views/template/search.html diff --git a/src/views/template/tips/404.html b/iframe/src/views/template/tips/404.html similarity index 100% rename from src/views/template/tips/404.html rename to iframe/src/views/template/tips/404.html diff --git a/src/views/template/tips/error.html b/iframe/src/views/template/tips/error.html similarity index 100% rename from src/views/template/tips/error.html rename to iframe/src/views/template/tips/error.html diff --git a/src/views/user/administrators/adminform.html b/iframe/src/views/user/administrators/adminform.html similarity index 100% rename from src/views/user/administrators/adminform.html rename to iframe/src/views/user/administrators/adminform.html diff --git a/src/views/user/administrators/list.html b/iframe/src/views/user/administrators/list.html similarity index 100% rename from src/views/user/administrators/list.html rename to iframe/src/views/user/administrators/list.html diff --git a/src/views/user/administrators/role.html b/iframe/src/views/user/administrators/role.html similarity index 100% rename from src/views/user/administrators/role.html rename to iframe/src/views/user/administrators/role.html diff --git a/src/views/user/forget.html b/iframe/src/views/user/forget.html similarity index 100% rename from src/views/user/forget.html rename to iframe/src/views/user/forget.html diff --git a/src/views/user/login.html b/iframe/src/views/user/login.html similarity index 100% rename from src/views/user/login.html rename to iframe/src/views/user/login.html diff --git a/src/views/user/reg.html b/iframe/src/views/user/reg.html similarity index 100% rename from src/views/user/reg.html rename to iframe/src/views/user/reg.html diff --git a/src/views/user/user/list.html b/iframe/src/views/user/user/list.html similarity index 100% rename from src/views/user/user/list.html rename to iframe/src/views/user/user/list.html diff --git a/src/views/user/user/userform.html b/iframe/src/views/user/user/userform.html similarity index 100% rename from src/views/user/user/userform.html rename to iframe/src/views/user/user/userform.html diff --git a/single/docs/docs.html b/single/docs/docs.html new file mode 100644 index 0000000..485c86d --- /dev/null +++ b/single/docs/docs.html @@ -0,0 +1,918 @@ + + +
+ + +++layuiAdmin pro (单页版)可以更轻松地实现前后端分离,它是 mvc 的简化版,全面接管 视图 和 页面路由,并可自主完成数据渲染,服务端通常只负责数据接口,而前端只需专注视图和事件交互,所有的页面动作都是在一个宿主页面中完成,因此这赋予了 + layuiAdmin 单页面应用开发的能力。
+
++ +由于 layuiAdmin 可采用前后端分离开发模式,因此你无需将其放置在你的服务端 MVC 框架中,你只需要给 + layuiAdmin 主入口页面(我们也称之为:宿主页面)进行访问解析,它即可全权完成自身路由的跳转和视图的呈现,而数据层则完全通过服务端提供的异步接口来完成。 +
+
- res/ # 静态资源目录
+ - adminui/ # layuiAdmin 主题核心代码目录(重要:一般升级时主要替换此目录)
+ - dist/ # 主题核心代码构建后的目录(为主要引用)
+ - modules/ # 主题核心 JS 模块
+ - css/ # 主题核心 CSS 样式
+ - src/ # 主题核心源代码目录(不推荐引用,除非要改动核心代码),结构同 dist 目录
+ - json/ # 用于演示的模拟数据
+ - layui/ # layui 组件库(重要:若升级 layui 直接替换该目录即可)
+ - modules/ # 业务 JS 模块(可按照实际的业务需求进行修改)
+ - style/ # 业务 CSS 图片等资源目录
+ - views/ # 业务动态模板视图碎片目录(可按照实际的业务需求进行修改)
+ - config.js # 初始化配置文件
+ - index.js # 初始化主题入口模块
+- index.html # 访问的主入口页面,可放置在任意地方(注意修改里面的 css/js 相关路径即可)
+
+ ++ +注意:上述为当前 layuiAdmin v2.x 单页版的最新版本的目录结构
+
根目录下的 index.html
+ 即是宿主页面,也是访问的主入口页面,它是整个单页面的承载,所有的界面都是在这一个页面中完成跳转和渲染的。事实上,宿主页面可以放在任何地方,但是要注意修改里面的
+ <link> <script> 的 src 和 layui.config 中 base
+ 的路径(可以指向任意存放 JS/CSS 等静态资源的路径),以及 views/layout.html 里面对应的 lay-url=""
+ 模拟接口路径。
当你已经顺利在本地预览了 layuiAdmin 后,你一定迫不及待关注更深层的结构。打开 src 目录,你将看到 config.js,里面存储着所有的默认配置。你可以按照实际需求选择性修改,下面是
+ layuiAdmin 默认提供的配置:
layui.define(function(exports){
+ exports('setter', {
+ paths: { // v1.9.0 及以上版本的写法
+ core: layui.cache.base + 'adminui/dist/', // 核心库所在目录
+ views: layui.cache.base + 'views/', // 业务视图所在目录
+ modules: layui.cache.base + 'modules/', // 业务模块所在目录
+ base: layui.cache.base // 记录静态资源所在基础目录
+ },
+ /* v1.9.0 之前的写法
+ views: layui.cache.base + 'views/', // 业务视图所在目录
+ base: layui.cache.base, // 记录静态资源所在基础目录
+ */
+
+ container: 'LAY_app', // 容器ID
+ entry: 'index', // 默认视图文件名
+ engine: '.html', // 视图文件后缀名
+ pageTabs: false, // 是否开启页面选项卡功能。单页版不推荐开启
+ refreshCurrPage: true, // 当跳转页面 url 与当前页 url 相同时,是否自动执行刷新 --- 2.0+
+
+ name: 'layuiAdmin Pro',
+ tableName: 'layuiAdmin', // 本地存储表名
+ MOD_NAME: 'admin', // 模块事件名
+
+ debug: true, // 是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
+ interceptor: false, // 是否开启未登入拦截
+
+ // 自定义请求字段
+ request: {
+ tokenName: 'access_token' // 自动携带 token 的字段名。可设置 false 不携带。
+ },
+
+ // 自定义响应字段
+ response: {
+ statusName: 'code', // 数据状态的字段名称
+ statusCode: {
+ ok: 0, // 数据状态一切正常的状态码
+ logout: 1001 // 登录状态失效的状态码
+ },
+ msgName: 'msg', // 状态信息的字段名称
+ dataName: 'data' // 数据详情的字段名称
+ },
+
+ // 独立页面路由,可随意添加(无需写参数)
+ indPage: [
+ '/user/login', // 登入页
+ '/user/reg', // 注册页
+ '/user/forget', // 找回密码
+ '/template/tips/test' // 独立页的一个测试 demo
+ ],
+
+ // 配置业务模块目录中的特殊模块
+ extend: {
+ layim: 'layim/layim' // layim
+ },
+
+ // 主题配置
+ theme: {
+ // 配色方案,如果用户未设置主题,第一个将作为默认
+ color: [{
+ main: '#20222A', // 主题色
+ selected: '#009688', // 选中色
+ logo: '', // logo 区域背景色
+ header: '', // 头部区域背景色
+ alias: 'default', // 默认别名
+ }], // 为了减少篇幅,更多主题此处不做列举,可直接参考 config.js
+
+ // 初始的颜色索引,对应上面的配色方案数组索引
+ // 如果本地已经有主题色记录,则以本地记录为优先,除非清除 localStorage(步骤:F12呼出调试工具→Aplication→Local Storage→选中页面地址→layuiAdmin→再点上面的X)
+ // 1.0 正式版开始新增
+ initColorIndex: 0
+ }
+ });
+});
+
+
+ 侧边菜单最多可支持到三级。无论你采用静态的菜单还是动态的,菜单的数据格式都必须是一段合法的 + JSON,且必须符合以下规范:
+{
+ "code": 0 //状态码,key 名可以通过 config.js 去重新配置
+ ,"msg": "" //提示信息
+ ,"data": [{ //菜单数据,key名可以通过 config.js 去重新配置
+ "name": "component" //一级菜单名称(与视图的文件夹名称和路由路径对应)
+ ,"title": "组件" //一级菜单标题
+ ,"icon": "layui-icon-component" //一级菜单图标样式
+ ,"jump": '' //自定义一级菜单路由地址,默认按照 name 解析。一旦设置,将优先按照 jump 设定的路由跳转
+ ,"spread": true //是否默认展子菜单(1.0.0-beta9 新增)
+ ,"list": [{ //二级菜单
+ "name": "grid" //二级菜单名称(与视图的文件夹名称和路由路径对应)
+ ,"title": "栅格" //二级菜单标题
+ ,"jump": '' //自定义二级菜单路由地址
+ ,"spread": true //是否默认展子菜单(1.0.0-beta9 新增)
+ ,"list": [{ //三级菜单
+ "name": "list" //三级菜单名(与视图中最终的文件名和路由对应),如:component/grid/list
+ ,"title": "等比例列表排列" //三级菜单标题
+ },{
+ "name": "mobile"
+ ,"title": "按移动端排列"
+ }
+ }]
+}
+
+ ++TIPS:实际运用时,切勿出现上述中的注释,否则将不是合法的 JSON ,会出现解析错误。
+
需要注意的是以下几点:
+a,二级菜单的是:b,三级菜单的 name 是
+ c,那么:
+ /a/b/c/a/b//a/"jump":
+ "/user/set"layuiAdmin 的路由是采用 location.hash 的机制,即路由地址是放在 ./#/ 后面,并通过
+ layui 自带的方法: layui.router() 来进行解析。每一个路由都对应一个真实存在的视图文件,且路由地址和视图文件的路径是一致的(相对
+ views 目录)。因此,你不再需要通过配置服务端的路由去访问一个页面,也无需在 layuiAdmin
+ 内部代码中去定义路由,而是直接通过 layuiAdmin 的前端路由去访问,即可匹配相应目录的视图,从而呈现出页面结果。
+
./#/path1/path2/path3/key1=value1/key2=value2…
+
+ 一个实际的示例:
+./#/user/set
+./#/user/set/uid=123/type=1#xxx(下面将以这个为例继续讲解)
+
+ 当你需要对路由结构进行解析时,你只需要通过 layui 内置的方法 layui.router()
+ 即可完成。如上面的路由解析出来的结果是:
{
+ path: ['user','set']
+ ,search: {uid: 123, type: 1}
+ ,href: 'user/set/uid=123/type=1'
+ ,hash: 'xxx'
+}
+
+ 可以看到,不同的结构会自动归纳到相应的参数中,其中:
++++
+- path:存储的是路由的目录结构
+- search:存储的是路由的参数部分
+- href:存储的是 layuiAdmin 的完整路由地址
+- hash:存储的是 layuiAdmin 自身的锚记,跟系统自带的
+location.hash有点类似
通过 layui.router() 得到路由对象后,你就可以对页面进行个性化操作、异步参数传值等等。如:
//在 JS 中获取路由参数
+var router = layui.router();
+admin.req({
+ url: 'xxx'
+ ,data: {
+ uid: router.search.uid
+ }
+});
+
+ <!-- 在动态模板中获取路由参数 -->
+<script type="text/html" template lay-url="./xxx/?uid={{ layui.router().search.uid }}">
+ …
+</script>
+
+<!-- 或 -->
+<script type="text/html" template lay-url="./xxx/" lay-data="{uid:'{{ layui.router().search.uid }}'}">
+ …
+</script>
+
+
+ 通过上文的路由规则,你已经大致清楚了 layuiAdmin 路由的基本原理和解析方法。那么如何完成路由的跳转呢?
+lay-href="/user/set/uid=123/type=1" ,好处是:任意元素都可以触发跳转。缺点是:只能在浏览器当前选项卡完成跳转(注意:不是
+ layuiAdmin 的选项卡)
+ <a href="#/user/set">text</a>
+ 。好处是:你可以通过设定 target="_blank" 来打开一个浏览器新选项卡。缺点是:只能设置
+ a 标签,且前面必须加 /#/location.hash = '/user/set'; 来跳转。前面无需加 #,它会自动追加。
+ 在路由结尾部分出现的 / 与不出现,是两个完全不同的路由。比如下面这个:
因此一定要注意结尾处的 /,避免视图读取错误。
这或许是你应用 layuiAdmin 时的主要焦点,在开发过程中,你的大部分精力都可能会聚焦在这里。它取代了服务端 MVC + 架构中的 view 层,使得应用开发变得更具扩展性。因此如果你采用 layuiAdmin 的 + SPA(单页应用)模式,请务必要抛弃服务端渲染视图的思想,让页面的控制权限重新回归到前端吧!
+++views 目录存放的正是视图文件,你可以在该目录添加任意的新目录和新文件,通过对应的路由即可访问。 +
+
注意:如果是单页面模式,视图文件通常是一段 HTML 碎片,而不能是一个完整的 html 代码结构。
+ +每一个视图文件,都对应一个路由。其中 index.html 是默认文件(你也可以通过 config.js
+ 去重新定义)。视图文件的所在目录决定了路由的访问地址,如:
| 视图路径 | +对应的路由地址 | +
|---|---|
| ./views/user/index.html | +/user/ | +
| ./views/user.html | +/user | +
| ./views/user/set/index.html | +/user/set/ | +
| ./views/user/set.html | +/user/set | +
| ./views/user/set/base.html | +/user/set/base | +
通过上述的表格列举的对应关系,可以总结出:
+/ 结尾
+ / 结尾++ +值得注意的是:路由路径并非最多只能三级,它可以无限极。但对应的视图也必须存放在相应的层级目录下
+
在视图文件中,除了写 HTML,也可以写 JavaScript 代码。如:
+<div id=“LAY-demo-hello”>Hello layuiAdmin</div>
+<script>
+layui.use('admin', function(){
+ var $ = layui.jquery;
+ admin.popup({
+ content: $('#LAY-demo-hello').html()
+ });
+});
+</script>
+
+ 如果该视图对应的 JS 代码量太大,我们更推荐你在 controller 目录下新增一个业务模块,并在视图中直接
+ layui.use 去加载该模块。下面以控制台主页 index.html 为例:
<div>html区域<div>
+
+<script>
+//加载 controller 目录下的对应模块
+/*
+ 小贴士:
+ 这里 console 模块对应 的 console.js 并不会重复加载,
+ 然而该页面的视图可能会重新插入到容器,那如何保证脚本能重新控制视图呢?有两种方式:
+ 1): 借助 layui.factory 方法获取 console 模块的工厂(回调函数)给 layui.use
+ 2): 直接在 layui.use 方法的回调中书写业务代码,即:
+ layui.use('console', function(){
+ //同 console.js 中的 layui.define 回调中的代码
+ });
+
+ 这里我们采用的是方式1。其它很多视图中采用的其实都是方式2,因为更简单些,也减少了一个请求数。
+
+*/
+layui.use('console', layui.factory('console'));
+</script>
+
+ 当视图被渲染后,layui.factory 返回的函数也会被执行,从而保证在不重复加载 JS + 模块文件的前提下,保证脚本能重复执行。
+ +layuiAdmin + 的视图是一个“动静结合”的载体,除了常规的静态模板,你当然还可以在视图中存放动态模板,因此它可谓是焦点中的焦点。
+ +在视图文件中,通过下述规则定义模板:
+<script type="text/html" template>
+ <!-- 动态模板碎片 -->
+</script>
+
+ 下面是一个简单的例子:
+<script type="text/html" template>
+ 当前 layuiAdmin 的版本是:{{ layui.admin.v }}
+ 路由地址:{{ layui.router().href }}
+</script>
+
+ + 在不对动态模板设定数据接口地址的情况下,它能读取到全局对象。但更多时候,一个动态模板应该是对应一个接口地址,如下所示:
+<script type="text/html" template lay-url="接口地址">
+ 我叫:{{ d.data.username }}
+ {{# if(d.data.sex === '男'){ }}
+ 公的
+ {{# } else { }}
+ 母的
+ {{# } }}
+</script>
+
+ 模板中的 d 对应的是你接口返回的 json 转化后的一维对象,如:
{
+ "code": 0
+ ,"data": {
+ "username": "贤心"
+ ,"sex": "男"
+ }
+}
+
+ 那么,上述动态模板最终输出的结果就是:
+我叫:贤心
+公的
+
+
+ 动态模板支持以下基础属性
+<script type="text/html" template lay-url="https://api.xxx.com?id={{ layui.router().search.id }}">
+ <!-- 动态模板碎片 -->
+</script>
+
+ <script type="text/html" template lay-url="接口地址" lay-type="post">
+ <!-- 动态模板碎片 -->
+</script>
+
+ <script type="text/html" template lay-url="接口地址" lay-data="{id: '{{ layui.router().search.id }}', type: 1}">
+ <!-- 动态模板碎片 -->
+</script>
+
+ lay-headers
+ 用户定义接口请求的 Request Headers 参数,用法与 lay-data 的完全类似,支持动态模板解析。
lay-done
+ 接口请求完毕并完成视图渲染的回调脚本,里面支持写任意的 JavaScript 语句。事实上它是一个封闭的函数作用域,通过给
+ Function 实例返回的函数传递一个参数 d,用于得到接口返回的数据:
<script type="text/html" template lay-url="接口地址" lay-done="console.log(d);">
+ <!-- 动态模板碎片 -->
+</script>
+
+ 很多时候,你在动态模板中可能会放入一些类似于 layui 的 form 元素,而有些控件需要执行
+ form.render() 才会显示,这时,你可以对 lay-done 赋值一个全局函数,如:
<script type="text/html" template lay-url="接口地址" lay-done="layui.data.done(d);">
+ <div class="layui-form" lay-filter="LAY-filter-demo-form">
+ <input type="checkbox" title="复选框">
+ </div>
+</script>
+
+<!-- 定义方法 -->
+<script>
+layui.data.done = function(d){
+ layui.use(['form'], function(){
+ var form = layui.form;
+ form.render(null, 'LAY-filter-demo-form'); //渲染该模板下的动态表单
+ });
+};
+</script>
+
+ TIPS:
+++ ++
+- 如果模板渲染完毕需要处理过多的交互,我们强烈推荐你采用上述的方式定义一个全局函数赋值给 + lay-done,会极大地减少维护成本。 +
+- + 无需担心该全局函数的冲突问题,该函数是一次性的。其它页面即便声明了一个同样的函数,也只是用于新的视图,丝毫不会对之前的视图造成任何影响。 +
+- layui.data.done 中的 done 可以随意命名,但需与 lay-done 的赋值对应上。
+
动态模板基于 layui 的 laytpl 模块,详细语法可见:
+ http://www.layuion.com/doc/modules/laytpl.html#syntax
+
由于 layuiAdmin 接管了视图层,所以不必避免可能会与服务端分开部署,这时你有必要了解一下 layuiAdmin 默认提供的:从 + 登录 到 接口鉴权,再到 注销 的整个流程。
+进入登入页面登入成功后,会在 localStorage 的本地表中写入一个字段。如: access_token (名称可以在 config.js + 自定义)。拦截器判断没有 access_token 时,则会跳转到登入页。尽管可以通过伪造一个假的 access_token + 绕过视图层的拦截,但在请求接口时,会自动带上 access_token,服务端应再次做一层校验。
+config.js ,将 interceptor 参数设置为 true(该参数为
+ 1.0.0-beta6 开始新增)。那么,当其未检查到 access_token 值时,会强制跳转到登录页面,以获取
+ access_token。
+ views/user/login.html,在代码最下面,你将看到一段已经写好的代码,你需要的是将接口地址改为服务端的真实接口,并返回
+ access_token 值。
+ access_token 值进行本地存储,这时你会发现 layuiAdmin
+ 不再强制跳转到登录页面。并在后面每次请求服务端接口时,都会自动在参数和 Request Headers 中带上 access_token,以便服务端进行鉴权。
+ code 应返回 1001(可在
+ config.js 自定义) , layuiAdmin 将会自动清空本地无效 token 并跳转到登入页。
+ controller/common.js,搜索 logout,配上注销接口即可。++如果是在其它场景请求的接口,如:table.render(),那么你需要获取本地存储的 token 赋值给接口参数,如下:
+
//设置全局 table 实例的 token(这样一来,所有 table 实例均会有效)
+table.set({
+ headers: { //通过 request 头传递
+ access_token: layui.data('layuiAdmin').access_token
+ }
+ ,where: { //通过参数传递
+ access_token: layui.data('layuiAdmin').access_token
+ }
+});
+
+
+//设置单个 table 实例的 token
+table.render({
+ elem: '#xxxx'
+ ,url: 'url'
+ ,where: {
+ access_token: layui.data('layuiAdmin').access_token
+ }
+ //,headers: {}
+});
+
+ 事实上,layuiAdmin 的所有 Ajax 请求都是采用 admin.req(options),它会自动传递 access_token,因此推荐你在
+ JS 执行 Ajax 请求时直接使用它。其中参数 options 和 $.ajax(options) 的参数完全一样。
+
我们推荐服务端遵循 JWT(JSON Web Token) 标准进行鉴权。对 JWT + 不甚了解的同学,可以去搜索一些相关资料,会极大地增加应用的可扩展性。当然,你也可以直接采用传统的 cookie / + session 机制。
+ +++ +你可以在任何地方通过
+layui.setter得到 config.js 中的配置信息
++var admin = layui.admin;
+
admin.req(options)
+ Ajax 请求,用法同 $.ajax(options),只是该方法会进行错误处理和 token 的自动传递
admin.screen()
+ 获取屏幕类型,根据当前屏幕大小,返回 0 - 3 的值
+ 0: 低于768px的屏幕
+ 1:768px到992px之间的屏幕
+ 2:992px到1200px之间的屏幕
+ 3:高于1200px的屏幕
admin.exit()
+ 清除本地 token,并跳转到登入页
admin.sideFlexible(status)
+ 侧边伸缩。status 为 null:收缩;status为 “spread”:展开
admin.on(eventName, callback)
+ 事件获取,下文会有讲解
admin.popup(options)
+ 弹出一个 layuiAdmin 主题风格的 layer 层,参数 options 跟 layer.open(options) 完全相同
admin.popupRight(options)
+ 在屏幕右侧呼出一个面板层。options 同上。
admin.popupRight({
+ id: 'LAY-popup-right-new1' //定义唯一ID,防止重复弹出
+ ,success: function(){
+ //将 views 目录下的某视图文件内容渲染给该面板
+ layui.view(this.id).render('视图文件所在路径');
+ }
+});
+
+ admin.resize(callback)
+ 窗口 resize 事件处理,我们推荐你使用该方法取代 jQuery 的 resize 事件,以避免多页面标签下可能存在的冲突。
+
admin.fullScreen()
+ 全屏
admin.exitScreen()
+ 退出全屏
admin.events
+admin.events.refresh()
+ 刷新当前右侧区域
admin.events.closeThisTabs()
+ 关闭当前标签页
admin.events.closeOtherTabs()
+ 关闭其它标签页
admin.events.closeAllTabs()
+ 关闭全部标签页
++var view = layui.view;
+
//渲染视图,viewPath 即为视图路径
+view('id').render(viewPath).then(function(){
+ //视图文件请求完毕,视图内容渲染前的回调
+}).done(function(){
+ //视图文件请求完毕和内容渲染完毕的回调
+});
+
+
+ 也可以通过 send 方法直接向容器中插入模板:
//tpl 为 模板字符;data 是传入的数据。该方法会自动完成动态模板解析
+view('id').send(tpl, data);
+
+ 一般我们还是推荐 render 方法,因为它请求的是一个独立的模板碎片,可以保证代码的可维护性。该方法同样支持动态传参,并可在视图的动态模板中使用。如:
+
admin.popup({
+ id: 'LAY-popup-test1'
+ ,success: function(){
+ view(this.id).render('视图文件所在路径', {
+ id: 123 //这里的 id 值你可以在一些事件中动态获取(如 table 模块的编辑)
+ });
+ }
+});
+
+ 那么,在视图文件中,你可以在动态模板中通过 {{ d.params.xxx }} 得到传入的参数,如:
<script type="text/html" template lay-url="http://api.com?id={{ d.params.id }}">
+ 配置了接口的动态模板,且接口动态获取了 render 传入的参数:{{ d.params.id }}
+</script>
+
+<script type="text/html" template>
+ 也可以直接获取:<input type="hidden" name="id" value="{{ d.params.id }}">
+</script>
+
+ 而如果是在 JS 语句中去获取模板传递过来的变量,可以借助动态模板的 lay-done 属性去实现,如: +
+<script type="text/html" template lay-done="layui.data.sendParams(d.params)">
+
+</script>
+
+ 然后在 JS 语句中通过执行动态模板 lay-done 中对应的方法得到对应的参数值:
+<script>
+//定义一个 lay-done 对应的全局方法,以供动态模板执行
+layui.data.sendParams = function(params){
+ console.log(params.id) //得到传递过来的 id 参数(或其他参数)值
+
+ //通过得到的参数值,做一些你想做的事
+ //…
+
+ //若需用到 layui 组件,layui.use 需写在该全局方法里面,如:
+ layui.use(['table'], function(){
+ var table = layui.table;
+ table.render({
+ elem: ''
+ ,url: 'url?id='+ params.id
+ });
+ });
+};
+</script>
+
+ 总之,驾驭好 view().render().done(callback) 对您的项目开发至关重要。
如果你开启了标签页功能,请务必注意 ID 的冲突,尤其是在你自己绑定事件的情况。ID + 的命令可以遵循以下规则来规避冲突:
+LAY-路由-任意名
+
+ 以消息中心页面为例,假设它的路由为:/app/message/,那么 ID 应该命名为:
<button class="layui-btn" id="LAY-app-message-del">删除</button>
+
+
+ 通过对元素设置 lay-tips="提示内容" 来开启一个 hover 提示,如:
<i class="layui-icon layui-icon-tips" lay-tips="要支持的噢" lay-offset="5"></i>
+
+ 其中 lay-offset 用于定于水平偏移距离(单位px),以调整箭头让其对准元素
// 下述中的 xxx 可随意定义,不可与已经定义的 hash 事件同名,否则会覆盖上一事件
+admin.on('hash(xxx)', function(router){
+ console.log(router); //得到路由信息
+});
+
+ // 下述中的 xxx 可随意定义,不可与已经定义的 side 事件同名,否则会覆盖上一事件
+admin.on('side(xxx)', function(obj){
+ console.log(obj.status); //得到伸缩状态:spread 为展开状态,其它值为收缩状态
+});
+
+
+ layuiAdmin 使用到了 layui 的栅格系统,而栅格则是基于浏览器的媒体查询。ie8、9不支持。
+ 所以要在宿主页面(如 index.html )加上下面这段保证兼容:
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
+<!--[if lt IE 9]>
+ <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
+ <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
+<![endif]-->
+
+
+
+ 由于单页面版本的视图文件和静态资源模块都是动态加载的,所以可能存在浏览器的本地缓存问题,事实上我们也考虑到这个,因此,为了避免改动后的文件未及时生效,你只需在入口页面(index.html)中,找到
+ layui.config ,修改其 version 的值即可。
++ +我们推荐你分场景来更新缓存:
++
+- 场景一:如果项目是在本地开发。你可以设置 version 为动态毫秒数,如:
++version: new Date().getTime() //这样你每次刷新页面,都会更新一次缓存 +
++
+- 场景二:如果项目是在线上运行。建议你手工更新
+version,如:+version: '1.0.0' //每次发布项目时,跟着改动下该属性值即可更新静态资源的缓存 +
++layuiAdmin + 受国家计算机软件著作权保护,禁止公开及传播模板源文件、盗版及非法倒卖等,违者将自行承担相应的法律责任。
+
© layuiAdmin
+