'a'
mh-two-thousand-and-two
2024-04-12 44d2c92345cd156a59fc327b3060292a282d2893
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import {
  isTabBarPage
} from '../util'
 
import tabBar from '../../framework/tab-bar'
 
export function setTabBarBadge ({
  index,
  text,
  type = 'text'
}) {
  tabBar.setTabBarBadge(type, index, text)
  return {
    errMsg: 'setTabBarBadge:ok'
  }
}
 
export function setTabBarItem ({
  index,
  text,
  iconPath,
  selectedIconPath,
  pagePath,
  visible,
  iconfont
}) {
  tabBar.setTabBarItem(index, text, iconPath, selectedIconPath, visible, iconfont)
  const route = pagePath && __uniRoutes.find(({ path }) => path === pagePath)
  if (route) {
    const meta = route.meta
    meta.isTabBar = true
    meta.tabBarIndex = index
    meta.isQuit = true
    const tabBar = __uniConfig.tabBar
    if (tabBar && tabBar.list && tabBar.list[index]) {
      tabBar.list[index].pagePath = pagePath.startsWith('/') ? pagePath.substring(1) : pagePath
    }
  }
  return {
    errMsg: 'setTabBarItem:ok'
  }
}
 
export function setTabBarStyle (style = {}) {
  if (!isTabBarPage()) {
    return {
      errMsg: 'setTabBarStyle:fail not TabBar page'
    }
  }
  const borderStyles = {
    black: 'rgba(0,0,0,0.4)',
    white: 'rgba(255,255,255,0.4)'
  }
  const borderStyle = style.borderStyle
  if (borderStyle in borderStyles) {
    style.borderStyle = borderStyles[borderStyle]
  }
  tabBar.setTabBarStyle(style)
  return {
    errMsg: 'setTabBarStyle:ok'
  }
}
 
export function hideTabBar ({
  animation
}) {
  if (!isTabBarPage()) {
    return {
      errMsg: 'hideTabBar:fail not TabBar page'
    }
  }
  tabBar.hideTabBar(animation)
  return {
    errMsg: 'hideTabBar:ok'
  }
}
 
export function showTabBar ({
  animation
}) {
  if (!isTabBarPage()) {
    return {
      errMsg: 'showTabBar:fail not TabBar page'
    }
  }
  tabBar.showTabBar(animation)
  return {
    errMsg: 'showTabBar:ok'
  }
}