基于React和Node.JS的表单录入系统的设计与实现 (3)

路由跳页模块的封装

import Taro from '@tarojs/taro'; // https://taro-docs.jd.com/taro/docs/apis/route/navigateTo export const goToPage = (page, params = {}, success, events) => { let url = `/pages/${page}/index`; if (Object.keys(params).length > 0) { let paramsStr = ''; for (const key in params) { const tmpStr = `${key}=${params[key]}`; paramsStr = tmpStr + '&'; } if (paramsStr.endsWith('&')) { paramsStr = paramsStr.substr(0, paramsStr.length - 1); } if (paramsStr) { url = `${url}?${paramsStr}`; } } Taro.navigateTo({ url, success, events }); };

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzfpzw.html