鍍金池/ 問答/HTML/ nuxt.js中使用fullPage.js, 頁面刷新后無效

nuxt.js中使用fullPage.js, 頁面刷新后無效

nuxt.js項(xiàng)目中, mounted里初始化fullPage, 路由跳到這個頁面全屏滾動沒有問題, 在這個頁面點(diǎn)瀏覽器的刷新按鈕之后, 就只顯示第一屏, 不能滾動了, 求大佬解答
jq和jquery.fullpage.min.css都引入了

if (process.browser) {
    require('fullpage.js/dist/jquery.fullpage.min.js')
    $('#fullpage').fullpage({
        recordHistory: false,
        navigation: true,
        navigationPosition: 'right',
        paddingTop: 40,
        onLeave (index, nextIndex, direction) {
            that.nextIndex = nextIndex
        }
    });
}
回答
編輯回答
胭脂淚

我也遇到了同樣的問題!

2017年4月14日 02:00
編輯回答
伴謊
mounted() {
    if ($('html').hasClass('fp-enabled')) {
      $.fn.fullpage.destroy('all');
    }
    $(function () {
      $("#ido").fullpage({
        //綁定菜單
        anchors: ['page1', 'page2', 'page3', 'page4'],
        menu: '#menu',
        css3: true
      });
    });
  },
  beforeDestroy() {
    // 頁面離開的時候 一定要銷毀fullpage實(shí)例  不然頁面無法滑動
    if ($('html').hasClass('fp-enabled')) {
      $.fn.fullpage.destroy('all');
      $('#menu').remove();
    }
  }
2017年7月5日 20:10