common_sider.html 2.0 KB

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