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: '跳转路径配置错误！',
      });
    }
  }
  