vue-尊龙游戏旗舰厅官网
尊龙游戏旗舰厅官网
收集整理的这篇文章主要介绍了
vue-router常见问题尊龙游戏旗舰厅官网的解决方案。(滚轴回到顶部、页面跳转同一页面报错、手机电脑端路由跳转)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
当页面跳转后,侧边滚轴会还是一个页面位置
//路由跳转后,页面回到顶部 router.aftereach(() => {document.body.scrolltop = 0;document.documentelement.scrolltop = 0; });页面跳转同一页面,报错
// 消除跳转同一个页面报错 const originalpush = router.prototype.push; router.prototype.push = function push(location) {return originalpush.call(this, location).catch((err) => err); };手机、电脑端路由跳转
const routes = [{path: '/',beforeenter(to, from, next) {let path;if (/android|webos|iphone|ipod|blackberry/i.test(navigator.useragent)) {console.log('-----这里是移动端-----');path = '/mb';} else {console.log('-----这里是电脑端-----');path = '/pc';}next(path);},}]总结
以上是尊龙游戏旗舰厅官网为你收集整理的vue-router常见问题尊龙游戏旗舰厅官网的解决方案。(滚轴回到顶部、页面跳转同一页面报错、手机电脑端路由跳转)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 【简易教程】基于vue-cli使用esl
- 下一篇: python——selenium框架实现