Coder Social home page Coder Social logo

Comments (12)

SilurianYang avatar SilurianYang commented on May 15, 2024 1

以.md结尾的文件即可,包括标题及正文。请发布到我的邮箱📬 我会在文档首页上说明出处。感谢你的支持!

from uni-simple-router.

SilurianYang avatar SilurianYang commented on May 15, 2024

这个问题 其实可以这样解决 在H5上 使用通配符 * 然后获取到 to 对象 接着你判断下当前是否在微信浏览器打开 如果是 你可以把 to 对象的 name 和query 组装成一个对象 最好转成字符串传递 作为到此个页面的参数 然后 重新 return 出去。 这样 在这个页面后面就保留了相关信息。 完事之后在beforeEach 中判断当前 to是否带了参数 如果有预设的微信浏览器的标识 那么就拿到 query后面的参数重新 next() 一下 这样就能完成了

from uni-simple-router.

minkuan avatar minkuan commented on May 15, 2024

@SilurianYang 文字描述清楚达义太难了:-) 然额通配符*分支,在其他页面都精确配置路由的情况下,由于不占优先级,*分支走不到吧?求出手更准确的代码:-)

from uni-simple-router.

SilurianYang avatar SilurianYang commented on May 15, 2024

@minkuan 那你可以把通配符的代码移植到 beforeEach 中一样可以使用 反应就是想办法 在路径过来拼接上当前页面的所有信息

from uni-simple-router.

SilurianYang avatar SilurianYang commented on May 15, 2024

@minkuan 你可以加群讨论或者完善 uni-simple-router 群号:769241495

from uni-simple-router.

minkuan avatar minkuan commented on May 15, 2024

router.beforeEach((to, from, next) => {
// #ifdef H5
console.log("beforeEach..to=", to, "..from=", from, "..to.query.wxRefreshed=", to.query.wxRefreshed, "..isWx=", Consts.isWeixin());
// #endif

// #ifdef H5
uni.getSystemInfo({
success: function(res) {
console.log("successFunc..res=", res);
if (res.platform === "ios") {
console.log('ios====platform======')
if (to.name !== "home" && Consts.isWeixin()) {
// 是否有微信标识url参数?
if (!Consts.intOrStringEqual(to.query.wxRefreshed, "2")) { // 没有微信url标识
let newQuery;
if (to.query.wxRefreshed===undefined) newQuery = Object.assign(to.query, {wxRefreshed: 1});
else {
newQuery = Object.assign(to.query, {wxRefreshed: parseInt(to.query.wxRefreshed)+1})
}
next({
path: to.path,
query: newQuery
});
} else {
console.log('wxRefreshed=2')
next();
}
} else next()
}
},
complete: function() {
console.log("getSystemInfo..complete");
}
});
// #endif

// #ifndef H5
next();
// #endif
});

@SilurianYang 因H5在微信中手工刷新2次后即可复制链接/在浏览器中打开成功,以上代码尝试做2次路由。以上处理为嘛无效呢?此前在目标页mounted中尝试window.location.replace(xxx)则uni-simple-router将陷入无限刷新

from uni-simple-router.

minkuan avatar minkuan commented on May 15, 2024

卧槽,搞定~

from uni-simple-router.

SilurianYang avatar SilurianYang commented on May 15, 2024

卧槽,搞定~

哦!伙计 看起来你成功啦! 恭喜你 ! 我很希望你能贡献你的源码 放置文档 相关教程 下帮助更多人

from uni-simple-router.

minkuan avatar minkuan commented on May 15, 2024

卧槽,搞定~

哦!伙计 看起来你成功啦! 恭喜你 ! 我很希望你能贡献你的源码 放置文档 相关教程 下帮助更多人

没问题,你这项目及文档做的还不错。你说下格式要求,分享互助更多人

from uni-simple-router.

minkuan avatar minkuan commented on May 15, 2024

以.md结尾的文件即可,包括标题及正文。请发布到我的邮箱 我会在文档首页上说明出处。感谢你的支持!

简单记个文档,没看到你邮箱。。btw 留下你邮箱地址吧,我发你邮箱

from uni-simple-router.

jpgaus avatar jpgaus commented on May 15, 2024

以.md结尾的文件即可,包括标题及正文。请发布到我的邮箱 我会在文档首页上说明出处。感谢你的支持!

简单记个文档,没看到你邮箱。。btw 留下你邮箱地址吧,我发你邮箱

遇到同样的问题,微信刷新死循环。您能发一份完整的文档吗? 我在官方文档教程没找到,非常感谢!

from uni-simple-router.

SilurianYang avatar SilurianYang commented on May 15, 2024

@jpgaus 这是楼主提供的解决方案 我上传上来 希望帮助更多需要的人
uni-simple-router解决IOS微信浏览器URL-BUG.docx

from uni-simple-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.