You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
641 B
41 lines
641 B
|
3 years ago
|
import {
|
||
|
|
onMethod,
|
||
|
|
invokeMethod
|
||
|
|
} from '../../platform'
|
||
|
|
|
||
|
|
import {
|
||
|
|
invoke
|
||
|
|
} from 'uni-core/service/bridge'
|
||
|
|
|
||
|
|
export function removeTabBarBadge ({
|
||
|
|
index
|
||
|
|
}) {
|
||
|
|
return invokeMethod('setTabBarBadge', {
|
||
|
|
index,
|
||
|
|
type: 'none'
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export function showTabBarRedDot ({
|
||
|
|
index
|
||
|
|
}) {
|
||
|
|
return invokeMethod('setTabBarBadge', {
|
||
|
|
index,
|
||
|
|
type: 'redDot'
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export const hideTabBarRedDot = removeTabBarBadge
|
||
|
|
|
||
|
|
const callbacks = []
|
||
|
|
|
||
|
|
onMethod('onTabBarMidButtonTap', res => {
|
||
|
|
callbacks.forEach(callbackId => {
|
||
|
|
invoke(callbackId, res)
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|
||
|
|
export function onTabBarMidButtonTap (callbackId) {
|
||
|
|
callbacks.push(callbackId)
|
||
|
|
}
|