首页 > 其他 > 详细

滚动行为

时间:2017-07-29 18:07:08      阅读:223      评论:0      收藏:0      [点我收藏+]

new router({

  scrollBehavior (to, from, savaPosition) {

    if(savePosition) {       //历史记录的前进后退记住的之前滚动到的位置

      return savePosition

    } else {

      return {x: 0, y: 0}

    }

//history模式下 定位到某个元素失效的解决办法

    if(to.hash) {

      return {

        selector: to.hash

      }

    } else {

      return {x: 0, y: 0}

    }

  }

})

滚动行为

原文:http://www.cnblogs.com/jessicaWy/p/7256914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!