Nuxt页面转换js未运行

时间:2021-07-17 09:39:08

标签: javascript vue.js nuxt.js

我很确定发生这种情况是有逻辑的原因,我正在尝试寻找一种方法来避免它,我正在使用带有 gsap 的页面转换,当浏览器重定向时标题所说的会发生什么到另一个带有转换的页面,bootstrap-select.js 不会运行并导致某些组件为空白。

int main(void) {
    int *ptr = malloc(sizeof(int));
    if (ptr == NULL) {
        puts("Could not allocate");
        return 1;
    }

    // safe to use pointer here.
    free(ptr);
    // but not here.
}

我怎样才能避免这个问题并在页面转换时再次运行脚本?

*编辑

  pageTransition: {
    name: 'page',
    mode: 'out-in',
    css: false,

    beforeEnter (el) {
      this.$gsap.set(el, {
        opacity: 0
      })
    },

    enter (el, done) {
      this.$gsap.to(el, {
        opacity: 1,
        duration: 0.5,
        ease: 'power2.inOut',
        onComplete: done
      })
    },

    leave (el, done) {
      this.$gsap.to(el, {
        opacity: 0,
        duration: 0.5,
        ease: 'power2.inOut',
        onComplete: done
      })
    }
  },

0 个答案:

没有答案