useSetTabbar.js 556 B

123456789101112131415161718192021222324252627282930
  1. import { useLoginUserStore } from '@/stores/loginUser'
  2. const loginUserStore = useLoginUserStore();
  3. export function useSetTabbar() {
  4. /**
  5. * 设置tabbar
  6. */
  7. const setTabbar = (index) => {
  8. let flag = false;
  9. switch(index){
  10. case 1:
  11. // 巡检
  12. if(loginUserStore.loginUser.menu.some(v => v.link === 'app.inspection.inspectList')){
  13. flag = true;
  14. }
  15. break;
  16. }
  17. if(flag){
  18. uni.setTabBarItem({
  19. index,
  20. visible: true,
  21. });
  22. }
  23. }
  24. return {
  25. setTabbar
  26. };
  27. }