slide.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="slide-layout nav-menu">
  3. <div class="navigator_menu">
  4. <span>导航面板</span>
  5. </div>
  6. <el-menu text-color="#999" active-text-color="#333" class="el-menu-vertical-demo" @select='handleSelect'>
  7. <template v-for="(nav, i) in navs">
  8. <router-link tag="div" :to="nav.link" :key="i" v-if="!nav.children">
  9. <el-menu-item :index="i+''" style="padding-left: 49px;">
  10. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+(Number(actice_idx)===i?nav.top + 14:nav.top)+'px'}"></i>
  11. <span slot="title">{{nav.text}}</span>
  12. </el-menu-item>
  13. </router-link>
  14. <el-submenu v-else :key="i" :index="i+''">
  15. <template slot="title">
  16. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+nav.top+'px'}"></i>
  17. <span style="padding-left:30px">{{nav.text}}</span>
  18. </template>
  19. <router-link tag="div" :to="nav.link" v-for="(nav, j) in nav.children" :key="j">
  20. <el-menu-item :index="i+'-'+j">{{nav.text}}</el-menu-item>
  21. </router-link>
  22. </el-submenu>
  23. </template>
  24. </el-menu>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'm-aside',
  30. component: {},
  31. data () {
  32. let navs = [
  33. { text: '首页', link: {name: 'Home'}, top: 14 },
  34. { text: '订单管理', link: {name: 'Order'}, top: 42 },
  35. // { text: '增值服务', link: {name: 'Added'}, top: 70 },
  36. // {
  37. // text: '代理平台',
  38. // link: {name: 'home'},
  39. // children: [
  40. // { text: '代理管理', link: {name: 'hone'} },
  41. // { text: '代理查询', link: {name: 'hone'} },
  42. // { text: '公告设置', link: {name: 'hone'} }
  43. // ],
  44. // top: 98
  45. // },
  46. { text: '设备管理', link: {name: 'device'}, top: 126 },
  47. { text: '发票管理', link: {name: 'invoice'}, top: 126 },
  48. {
  49. text: '更多设置',
  50. link: {name: 'home'},
  51. children: [
  52. { text: '场景管理', link: {name: 'scene'} },
  53. { text: '反馈消息', link: {name: 'feedback'} },
  54. { text: '设备管理', link: {name: 'device'} },
  55. { text: '客户管理', link: {name: 'client'} }
  56. ],
  57. top: 154
  58. },
  59. { text: '经销商申请', link: {name: 'distributor-list'}, top: 98 },
  60. { text: '留言管理', link: {name: 'leaving'}, top: 182 },
  61. {
  62. text: '版本管理',
  63. link: {name: 'edition'},
  64. children: [
  65. { text: '八目相机', link: {name: 'edition'}, top: 182 },
  66. { text: '转台相机', link: {name: 'turntableCamera'}, top: 182 }
  67. // { text: '反馈消息', link: {name: 'feedback'} },
  68. // { text: '设备管理', link: {name: 'device'} },
  69. // { text: '客户管理', link: {name: 'client'} }
  70. ],
  71. top: 154
  72. },
  73. // { text: '版本管理', link: {name: 'edition'}, top: 182 },
  74. { text: '数据统计', link: {name: 'Statistics'}, top: 210 }
  75. // { text: '数据下载', link: {name: 'Down'}, top: 210 }
  76. // ,
  77. // {
  78. // text: 'BBS',
  79. // link: {name: 'home'},
  80. // children: [
  81. // { text: '文章列表', link: {name: 'home'} },
  82. // { text: '评论管理', link: {name: 'home'} },
  83. // { text: '用户管理', link: {name: 'home'} }
  84. // ],
  85. // top: 182
  86. // }
  87. ]
  88. return {
  89. actice_idx: 1,
  90. navs: navs
  91. }
  92. },
  93. methods: {
  94. handleSelect (key) {
  95. console.log(key)
  96. this.actice_idx = key
  97. },
  98. openNotice () {
  99. this.$store.commit('SET_OPENNOTICE', true)
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped>
  105. .slide-layout {
  106. border: 1px solid #ebeef5;
  107. background: #ffffff;
  108. z-index: 1;
  109. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  110. }
  111. .nav-menu {
  112. padding-left: 5px;
  113. user-select: none;
  114. font-size: 20px;
  115. }
  116. .nav-menu-item {
  117. margin: 20px 0;
  118. }
  119. .menu-title {
  120. font-size: 18px;
  121. margin-left: 15px;
  122. }
  123. .jiantou {
  124. width: 8px;
  125. height: 8px;
  126. border-top: 2px solid #000;
  127. border-right: 2px solid #000;
  128. transform: rotate(135deg);
  129. display: inline-block;
  130. margin-left: 64px;
  131. }
  132. .flex-item {
  133. cursor: pointer;
  134. display: flex;
  135. align-items: center;
  136. transition: all 0.3s;
  137. }
  138. .flex-item-list {
  139. margin-left: 32px;
  140. margin-top: 20px;
  141. }
  142. .flex-item-list li {
  143. cursor: pointer;
  144. margin-top: 20px;
  145. color: #999;
  146. }
  147. .fade-enter-active,
  148. .fade-leave-active {
  149. transition: opacity .5s;
  150. }
  151. .fade-enter,
  152. .fade-leave-to
  153. /* .fade-leave-active below version 2.1.8 */
  154. {
  155. opacity: 0;
  156. }
  157. .iconfont {
  158. margin-right: 10px;
  159. }
  160. .navigator_menu {
  161. line-height: 56px;
  162. height: 56px;
  163. }
  164. .navigator_menu>span {
  165. padding-left: 20px;
  166. font-size: 12px;
  167. color: #999;
  168. }
  169. </style>
  170. <style type="text/css">
  171. .el-menu-item.is-active {
  172. background: #f2f2f2;
  173. /*color: #333;*/
  174. }
  175. .i-fix {
  176. display: inline-block;
  177. background-repeat: no-repeat;
  178. width: 14px;
  179. height: 14px;
  180. vertical-align: middle;
  181. background-image: url('~@/assets/images/icon/sys_icon.png')
  182. }
  183. .iconfonts {
  184. position: absolute;
  185. left: 20px;
  186. top: 50%;
  187. margin-top: -9px;
  188. }
  189. </style>