common_sider.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {{define "menuItems"}}
  2. <a-menu-item key="{{ .base_path }}panel/">
  3. <a-icon type="dashboard"></a-icon>
  4. <span>{{ i18n "menu.dashboard"}}</span>
  5. </a-menu-item>
  6. <a-menu-item key="{{ .base_path }}panel/inbounds">
  7. <a-icon type="user"></a-icon>
  8. <span>{{ i18n "menu.inbounds"}}</span>
  9. </a-menu-item>
  10. <a-menu-item key="{{ .base_path }}panel/settings">
  11. <a-icon type="setting"></a-icon>
  12. <span>{{ i18n "menu.settings"}}</span>
  13. </a-menu-item>
  14. <!--<a-menu-item key="{{ .base_path }}panel/clients">-->
  15. <!-- <a-icon type="laptop"></a-icon>-->
  16. <!-- <span>Client</span>-->
  17. <!--</a-menu-item>-->
  18. <a-menu-item key="{{ .base_path }}logout">
  19. <a-icon type="logout"></a-icon>
  20. <span>{{ i18n "menu.logout"}}</span>
  21. </a-menu-item>
  22. {{end}}
  23. {{define "commonSider"}}
  24. <a-layout-sider :theme="themeSwitcher.currentTheme" id="sider" collapsible breakpoint="md" collapsed-width="0">
  25. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" selected-keys="">
  26. <a-menu-item mode="inline">
  27. <a-icon type="bg-colors"></a-icon>
  28. <theme-switch />
  29. </a-menu-item>
  30. </a-menu>
  31. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  32. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  33. {{template "menuItems" .}}
  34. </a-menu>
  35. </a-layout-sider>
  36. <a-drawer id="sider-drawer" placement="left" :closable="false"
  37. @close="siderDrawer.close()"
  38. :visible="siderDrawer.visible"
  39. :wrap-class-name="themeSwitcher.darkDrawerClass"
  40. :wrap-style="{ padding: 0 }">
  41. <div class="drawer-handle" @click="siderDrawer.change()" slot="handle">
  42. <a-icon :type="siderDrawer.visible ? 'close' : 'menu-fold'"></a-icon>
  43. </div>
  44. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" selected-keys="">
  45. <a-menu-item mode="inline">
  46. <a-icon type="bg-colors"></a-icon>
  47. <theme-switch />
  48. </a-menu-item>
  49. </a-menu>
  50. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  51. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  52. {{template "menuItems" .}}
  53. </a-menu>
  54. </a-drawer>
  55. <script>
  56. const siderDrawer = {
  57. visible: false,
  58. show() {
  59. this.visible = true;
  60. },
  61. close() {
  62. this.visible = false;
  63. },
  64. change() {
  65. this.visible = !this.visible;
  66. },
  67. };
  68. </script>
  69. {{end}}