common_sider.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {{define "menuItems"}}
  2. <a-menu-item key="{{ .base_path }}panel/">
  3. <a-icon type="dashboard"></a-icon>
  4. <span><b>{{ i18n "menu.dashboard"}}</b></span>
  5. </a-menu-item>
  6. <a-menu-item key="{{ .base_path }}panel/inbounds">
  7. <a-icon type="user"></a-icon>
  8. <span><b>{{ i18n "menu.inbounds"}}</b></span>
  9. </a-menu-item>
  10. <a-menu-item key="{{ .base_path }}panel/settings">
  11. <a-icon type="setting"></a-icon>
  12. <span><b>{{ i18n "menu.settings"}}</b></span>
  13. </a-menu-item>
  14. <a-menu-item key="{{ .base_path }}panel/xray">
  15. <a-icon type="tool"></a-icon>
  16. <span><b>{{ i18n "menu.xray"}}</b></span>
  17. </a-menu-item>
  18. <a-menu-item key="{{ .base_path }}logout">
  19. <a-icon type="logout"></a-icon>
  20. <span><b>{{ i18n "menu.logout"}}</b></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. <theme-switch></theme-switch>
  26. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  27. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  28. {{template "menuItems" .}}
  29. </a-menu>
  30. </a-layout-sider>
  31. <a-drawer id="sider-drawer" placement="left" :closable="false"
  32. @close="siderDrawer.close()"
  33. :visible="siderDrawer.visible"
  34. :wrap-class-name="themeSwitcher.currentTheme"
  35. :wrap-style="{ padding: 0 }">
  36. <div class="drawer-handle" @click="siderDrawer.change()" slot="handle">
  37. <a-icon :type="siderDrawer.visible ? 'close' : 'menu-fold'"></a-icon>
  38. </div>
  39. <theme-switch></theme-switch>
  40. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  41. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  42. {{template "menuItems" .}}
  43. </a-menu>
  44. </a-drawer>
  45. <script>
  46. const siderDrawer = {
  47. visible: false,
  48. show() {
  49. this.visible = true;
  50. },
  51. close() {
  52. this.visible = false;
  53. },
  54. change() {
  55. this.visible = !this.visible;
  56. },
  57. };
  58. </script>
  59. {{end}}