Merge pull request #1126 from 2betop/bugfix

jumpTo 如果目标地址时当前应用,则用单页模式
This commit is contained in:
吴多益 2020-12-02 12:49:06 +08:00 committed by GitHub
commit e6536fe47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,23 @@ export default function (schema) {
updateLocation: (location, replace) => {
router[replace ? 'replace' : 'push'](normalizeLink(location));
},
jumpTo: (to, action) => {
if (to === 'goBack') {
return router.location.goBack();
}
to = normalizeLink(to);
if (action && action.actionType === 'url') {
action.blank === false
? (window.location.href = to)
: window.open(to);
return;
}
if (/^https?:\/\//.test(to)) {
window.location.replace(to);
} else {
router.push(to);
}
},
isCurrentUrl: to => {
const link = normalizeLink(to);
return router.isActive(link);