Sider.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <aside id="slider" class="main-sidebar">
  3. <section class="sidebar">
  4. <ul class="sidebar-menu">
  5. <template v-for="(item,index) in menus">
  6. <router-link class="treeview" :key="index" :to="item.path" tag="li" :exact="item.path == '/'" v-if="showMenu(item)">
  7. <a>
  8. <i :class="['fa', 'fa-' + item.icon]"></i>
  9. <span>{{item.title}}</span>
  10. </a>
  11. </router-link>
  12. </template>
  13. </ul>
  14. </section>
  15. </aside>
  16. </template>
  17. <script>
  18. import { mapState, mapActions } from "vuex";
  19. export default {
  20. props: {
  21. menus : {
  22. default : () => []
  23. }
  24. },
  25. computed: {
  26. ...mapState(['userInfo', 'serverInfo']),
  27. path(){
  28. return location.pathname;
  29. }
  30. },
  31. methods: {
  32. ...mapActions(["getServerInfo"]),
  33. showMenu(item) {
  34. if(item.versionType && item.versionType != this.serverInfo.VersionType) {
  35. return false;
  36. }
  37. if(item.roles && this.userInfo && !this.hasAnyRole(this.serverInfo, this.userInfo, ...item.roles)) {
  38. return false;
  39. }
  40. if(item.path == "/about" && this.serverInfo.ShowAbout === false) {
  41. return false;
  42. }
  43. if(item.hideInIE && videojs.browser.IE_VERSION) {
  44. return false;
  45. }
  46. return true;
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="css" scoped="true">
  52. .main-sidebar{
  53. /* Fix for IE */
  54. -webkit-transition: none;
  55. -o-transition: none;
  56. transition: none;
  57. }
  58. </style>