generated from ccsens_fe/uni-vue3-template
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
834 B
27 lines
834 B
/**
|
|
* 打开页面 timeout 1s执行
|
|
* @param {string} pageName 页面的名称 同文件名 文件夹名
|
|
* @param {boolean} isRedirect 是否是重定向 替换模式
|
|
* @param {string} query 查询参数 不带? 如 name=wally&age=17
|
|
*/
|
|
export function openPage(pageName: string, isRedirect = false, query?: string) {
|
|
const path = query ? `/pages/${pageName}/${pageName}?${query}` : `/pages/${pageName}/${pageName}`
|
|
if (isRedirect) {
|
|
setTimeout(() => {
|
|
uni.redirectTo({ url: path })
|
|
}, 1000)
|
|
} else {
|
|
setTimeout(() => {
|
|
uni.navigateTo({ url: path })
|
|
}, 1000)
|
|
}
|
|
}
|
|
|
|
// show modal 显示弹窗
|
|
export function alertError(error: any) {
|
|
let msg = error
|
|
if (typeof error === 'object') {
|
|
msg = JSON.stringify(error)
|
|
}
|
|
uni.showModal({ title: '提示', content: msg, showCancel: false })
|
|
}
|
|
|