2022-04-18 13:35:41 +08:00

25 lines
582 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Taro from "@tarojs/taro"
import Qs from 'qs'
/**
* 跳转
* @param path
* @param params
* @param type false 跳转普通页面true 跳转tabbar页面
*/
export const goLink = (path = '', params = {}, type:false|true = false) => {
if(path) {
let params_str = Qs.stringify(params)
path = params_str?path+'?'+params_str:path
if(!type) {
Taro.navigateTo({
url: path
})
} else {
Taro.switchTab({
url: path
})
}
}
}