在taro中跳转页面的时候执行两遍componentDidMount周期的原因和解决方法

在做taro跳转的时候,发现在跳转后的页面会走两遍componentDidMount周期,查看了github上的issues,发现是跳转路由带参为中文引起的,只要把中文参数进行urlencode解决

 Taro.navigateTo({url: `/pages/xxx/xxx?exam_name=${encodeURI(xxx)}`})

  

原文地址:https://www.cnblogs.com/mmykdbc/p/10119488.html