menu.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="menu-container">
  3. <top-bar></top-bar>
  4. <div class="menu-list">
  5. <div class="menu-list-item" v-for="(v,i) in menuList" :key="i">
  6. <p @click="onclick">{{v.meta.title}}</p>
  7. <van-grid border :column-num="3">
  8. <van-grid-item v-for="(item,index) in v.children" :key="index" :icon="imgUrl(item.meta.icon)" :text="item.meta.title" :to="item.path" />
  9. </van-grid>
  10. <!-- <li v-for="(item,index) in v.list" :key="index">-->
  11. <!-- <div></div>-->
  12. <!-- <p>{{item.menu}}</p>-->
  13. <!-- </li>-->
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import TopBar from "@/components/TopBar";
  20. import { mapGetters } from 'vuex'
  21. import {getMenu} from "@/api/public";
  22. export default {
  23. components:{TopBar},
  24. data() {
  25. return {
  26. menuList:[],
  27. }
  28. },
  29. computed: {
  30. ...mapGetters(['userName'])
  31. },
  32. mounted() {
  33. this.getMenuList()
  34. },
  35. methods: {
  36. getMenuList(){
  37. getMenu().then(res=>{
  38. console.log(res,'res')
  39. this.menuList = res.data
  40. })
  41. },
  42. onclick(){
  43. this.$router.push('/workTime')
  44. },
  45. }
  46. }
  47. </script>
  48. <style lang="scss" scoped >
  49. .menu-container{
  50. background-color: rgba(237, 252, 255, 1)
  51. }
  52. .menu-list{
  53. padding: 30px 0;
  54. height: calc(100vh - 400px);
  55. overflow: auto;
  56. }
  57. .menu-list-item{
  58. background-color: #fff;
  59. border-radius: 10px;
  60. box-shadow: 0 10px 20px #eee;
  61. margin:20px;
  62. >p{
  63. font-size: 30px;
  64. padding: 10px 10px 10px 20px;
  65. }
  66. >ul{
  67. display: flex;
  68. flex-wrap: wrap;
  69. font-size: 20px;
  70. >li{
  71. padding: 30px;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. >div{
  76. width: 60px;
  77. height: 60px;
  78. background-color: #42b983;
  79. margin-bottom: 20px;
  80. }
  81. }
  82. }
  83. }
  84. </style>