提交 31b1a2e9 编写于 作者: Q qiang

fix: 修复纯nvue模式路由API不触发回调的问题

上级 e4c0e281
...@@ -79,7 +79,7 @@ export function navigateBack ({ ...@@ -79,7 +79,7 @@ export function navigateBack ({
animationType, animationType,
animationDuration animationDuration
}) { }) {
const pages = getCurrentPages() const pages = getCurrentPages()
const currentPage = pages[pages.length - 1] const currentPage = pages[pages.length - 1]
if ( if (
...@@ -91,11 +91,15 @@ export function navigateBack ({ ...@@ -91,11 +91,15 @@ export function navigateBack ({
}) })
) { ) {
return return
} }
uni.hideToast() // 后退时,关闭 toast,loading uni.hideToast() // 后退时,关闭 toast,loading
currentPage.$page.meta.isQuit currentPage.$page.meta.isQuit
? quit() ? quit()
: back(delta, animationType, animationDuration) : back(delta, animationType, animationDuration)
}
return {
errMsg: 'navigateBack:ok'
}
}
...@@ -7,14 +7,15 @@ import { ...@@ -7,14 +7,15 @@ import {
} from './util' } from './util'
import { import {
setStatusBarStyle setStatusBarStyle,
invoke
} from '../../bridge' } from '../../bridge'
export function navigateTo ({ export function navigateTo ({
url, url,
animationType, animationType,
animationDuration animationDuration
}) { }, callbackId) {
const urls = url.split('?') const urls = url.split('?')
const path = urls[0] const path = urls[0]
...@@ -32,8 +33,13 @@ export function navigateTo ({ ...@@ -32,8 +33,13 @@ export function navigateTo ({
openType: 'navigate' openType: 'navigate'
}), }),
animationType, animationType,
animationDuration animationDuration,
() => {
invoke(callbackId, {
errMsg: 'navigateTo:ok'
})
}
) )
setStatusBarStyle() setStatusBarStyle()
} }
...@@ -7,14 +7,15 @@ import { ...@@ -7,14 +7,15 @@ import {
} from './util' } from './util'
import { import {
setStatusBarStyle setStatusBarStyle,
invoke
} from '../../bridge' } from '../../bridge'
import tabBar from '../../../../app-plus/service/framework/tab-bar' import tabBar from '../../../../app-plus/service/framework/tab-bar'
export function reLaunch ({ export function reLaunch ({
url url
}) { }, callbackId) {
const urls = url.split('?') const urls = url.split('?')
const path = urls[0] const path = urls[0]
...@@ -35,7 +36,12 @@ export function reLaunch ({ ...@@ -35,7 +36,12 @@ export function reLaunch ({
openType: 'reLaunch' openType: 'reLaunch'
}), }),
'none', 'none',
0 0,
() => {
invoke(callbackId, {
errMsg: 'reLaunch:ok'
})
}
) )
pages.forEach(page => { pages.forEach(page => {
...@@ -44,4 +50,4 @@ export function reLaunch ({ ...@@ -44,4 +50,4 @@ export function reLaunch ({
}) })
setStatusBarStyle() setStatusBarStyle()
} }
...@@ -7,12 +7,13 @@ import { ...@@ -7,12 +7,13 @@ import {
} from './util' } from './util'
import { import {
setStatusBarStyle setStatusBarStyle,
invoke
} from '../../bridge' } from '../../bridge'
export function redirectTo ({ export function redirectTo ({
url url
}) { }, callbackId) {
const urls = url.split('?') const urls = url.split('?')
const path = urls[0] const path = urls[0]
...@@ -33,8 +34,11 @@ export function redirectTo ({ ...@@ -33,8 +34,11 @@ export function redirectTo ({
0, 0,
() => { () => {
lastPage && lastPage.$getAppWebview().close('none') lastPage && lastPage.$getAppWebview().close('none')
invoke(callbackId, {
errMsg: 'redirectTo:ok'
})
} }
) )
setStatusBarStyle() setStatusBarStyle()
} }
...@@ -5,7 +5,8 @@ import { ...@@ -5,7 +5,8 @@ import {
} from './util' } from './util'
import { import {
setStatusBarStyle setStatusBarStyle,
invoke
} from '../../bridge' } from '../../bridge'
import tabBar from '../../../../app-plus/service/framework/tab-bar' import tabBar from '../../../../app-plus/service/framework/tab-bar'
...@@ -13,7 +14,7 @@ import tabBar from '../../../../app-plus/service/framework/tab-bar' ...@@ -13,7 +14,7 @@ import tabBar from '../../../../app-plus/service/framework/tab-bar'
export function switchTab ({ export function switchTab ({
url, url,
from from
}) { }, callbackId) {
const path = url.split('?')[0] const path = url.split('?')[0]
tabBar.switchTab(path.slice(1)) tabBar.switchTab(path.slice(1))
...@@ -66,8 +67,16 @@ export function switchTab ({ ...@@ -66,8 +67,16 @@ export function switchTab ({
path, path,
query: {}, query: {},
openType: 'switchTab' openType: 'switchTab'
}), 'none', 0, null, 70) }), 'none', 0, () => {
invoke(callbackId, {
errMsg: 'switchTab:ok'
})
}, 70)
return
} }
setStatusBarStyle() setStatusBarStyle()
return {
errMsg: 'switchTab:ok'
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册