1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- export const jump = (url, param, timeout = 0, type = 'default') => {
- setTimeout(() => {
- if (param) {
- url = `${url}?detail=${encodeURIComponent(JSON.stringify(param)?.replace(/%/g, '%25'))}`
- }
- if (type === 'default') {
- uni.navigateTo({ url })
- } else if (type === 'redirect') {
- uni.redirectTo({ url })
- } else {
- uni.reLaunch({ url })
- }
- }, timeout)
- }
- export const jumpToTabbar = (url, timeout = 0) => {
- setTimeout(() => {
- uni.switchTab({ url })
- }, timeout)
- }
- export const goBack = (delta = 1) => {
- uni.navigateBack({ delta })
- }
- export const getJumpParam = (loadParam) => {
- if (typeof loadParam === 'object' && loadParam?.detail) {
- return JSON.parse(decodeURIComponent(loadParam.detail))
- }
- return {}
- }
|