vantui-edit
Version:
一套适用于Taro3及React的vantui组件库
33 lines (29 loc) • 713 B
JavaScript
import { getCurrentPages, redirectTo, reLaunch, navigateTo } from '@tarojs/taro';
export function jumpLink(url, linkType) {
var _linkType;
linkType = (_linkType = linkType) !== null && _linkType !== void 0 ? _linkType : 'navigateTo';
if (url) {
if (linkType === 'navigateTo' && getCurrentPages().length > 9) {
redirectTo({
url: url
});
} else {
switch (linkType) {
case 'navigateTo':
navigateTo({
url: url
});
break;
case 'reLaunch':
reLaunch({
url: url
});
break;
case 'redirectTo':
redirectTo({
url: url
});
}
}
}
}