Lefter.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!--
  2. * @Author: jixiang
  3. * @Date: 2021-08-14 10:17:45
  4. * @Description: nav
  5. * @FilePath: /book_account/src/layout/Lefter.vue
  6. * One World One Drefeel(56580223@qq.com)
  7. -->
  8. <template>
  9. <div class="left_Navigation">
  10. <a-menu
  11. v-model:selectedKeys="state.selectedKeys"
  12. mode="inline"
  13. :theme="state.theme"
  14. @click="onClick"
  15. >
  16. <a-menu-item key="/bookManage"> 图书管理</a-menu-item>
  17. </a-menu>
  18. </div>
  19. </template>
  20. <script lang="ts" setup>
  21. import { WalletOutlined } from '@ant-design/icons-vue';
  22. import { defineComponent, reactive } from 'vue';
  23. import { useRouter, useRoute } from 'vue-router';
  24. const state = reactive({
  25. theme: 'light',
  26. selectedKeys: ['/bookManage'],
  27. });
  28. const router = useRouter();
  29. const routers = useRoute();
  30. function goToPage(path, pathName) {
  31. router.push({
  32. path: path,
  33. });
  34. }
  35. const onClick = (e) => {
  36. console.log(e, routers);
  37. router.push({
  38. path: e.key,
  39. });
  40. };
  41. </script>
  42. <style lang="less" scoped>
  43. .left_Navigation {
  44. background: #fff;
  45. border-right: 1px solid #f0f0f0;
  46. height: calc(100vh - 6.4rem);
  47. padding-top: 2rem;
  48. // position: fixed;
  49. width: 20rem;
  50. .item {
  51. cursor: pointer;
  52. height: 40px;
  53. line-height: 40px;
  54. text-align: center;
  55. }
  56. }
  57. </style>