menu-list.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>菜单预览</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
  11. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  12. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.min.js"></script>
  13. <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
  14. <script src="../../static/sa.js"></script>
  15. <style>
  16. body,.el-tree{background-color: #eee;}
  17. .el-tree-node{margin: 0.15em 0 !important;}
  18. /* 悬浮时颜色更深一点 */
  19. .el-tree-node__content:hover{background-color: #CFE8FC !important;}
  20. </style>
  21. </head>
  22. <body>
  23. <div class="vue-box" style="display: none;" :style="'display: block;'">
  24. <!-- 表格 -->
  25. <div style="padding: 0 1em;">
  26. <div class="c-title">菜单预览</div>
  27. <!-- 树插件 -->
  28. <el-tree
  29. ref="tree"
  30. :data="dataList"
  31. node-key="id"
  32. :default-expand-all="true"
  33. >
  34. <span class="custom-tree-node" slot-scope="s">
  35. <span style="color: #2D8CF0;" v-if="s.data.isShow == undefined || s.data.isShow == true">{{ s.data.name }}</span>
  36. <span style="color: #999;" v-if="s.data.isShow == false">{{ s.data.name }} (隐藏)</span>
  37. <span style="color: #999;" v-if="s.data.info">&emsp;———— {{s.data.info}} </span>
  38. </span>
  39. </el-tree>
  40. <br><br><br>
  41. </div>
  42. </div>
  43. <script src="../../sa-frame/menu-list.js"></script>
  44. <script src="../../sa-frame/menu-list-sp.js"></script>
  45. <script src="../../sa-frame/index/admin-util.js"></script>
  46. <script>
  47. var app = new Vue({
  48. el: '.vue-box',
  49. data: {
  50. dataList: [], // 数据集合
  51. },
  52. created: function(){
  53. // 全部
  54. sa.ajax2('/SysMenu/getList', function(res){
  55. menuList = sa_admin_code_util.arrayToTree(menuList); // 一维转tree
  56. menuList = sa_admin_code_util.refMenuList(menuList); // 属性处理
  57. this.dataList = menuList; // 数据
  58. }.bind(this));
  59. }
  60. })
  61. </script>
  62. </body>
  63. </html>