feat: 电子药箱小程序 - 4Tab药品管理
- 电子药箱: 药品库存管理 + 手动录入 + 今日用药打卡 - 药品百科: 搜索 + 分类筛选 + 20种药品静态数据 - 惠教中心: 4条药品使用指南课程 - 我的: 家庭成员信息管理 - 自定义TabBar + navigation-bar组件 - SVG药品分类插图
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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: '跳转路径配置错误!',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user