- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡 - 药品百科: 搜索 + 分类筛选 + 20种药品静态数据 - 惠教中心: 4条药品使用指南课程 - 我的: 家庭成员信息管理 - 自定义TabBar + navigation-bar组件 - SVG药品分类插图
33 lines
772 B
TypeScript
33 lines
772 B
TypeScript
export function redirect(e: any) {
|
|
try {
|
|
const link = e.currentTarget.dataset.linkurl || e.currentTarget.dataset.link;
|
|
const title = e.currentTarget.dataset.title;
|
|
|
|
if (!link) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '跳转路径配置为空!',
|
|
});
|
|
return;
|
|
}
|
|
|
|
let url = link.startsWith('/') ? link : '/' + link;
|
|
|
|
if (title) {
|
|
url += (url.includes('?') ? '&' : '?') + `title=${title}`;
|
|
}
|
|
|
|
if (url.includes('tab-bar')) {
|
|
wx.switchTab({ url });
|
|
} else {
|
|
wx.navigateTo({ url });
|
|
}
|
|
} catch (err) {
|
|
console.log(err);
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '跳转路径配置错误!',
|
|
});
|
|
}
|
|
}
|
|
|