javascript - using turn.js in vue
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-07-05 10:55:38
0
1
1993

Use turnjs in the vue component as a plug-in for turning books.
First introduce the corresponding jquery in index.html, and then in The component is as follows:

import turn from 'jsPath/lib/turn.min'
export default {
  mounted() {
    this.$nextTick(() => {
      $('.flipbook').turn({
        width: 922,
        height: 600,
        elevation: 50,
        gradients: true,
        autoCenter: true
      });
    });
  }
}

Sequential reference should be no problem, but the turn function cannot be called, and the console reports an error, TypeError: $(...).turn is not a function.
Has anyone used this plug-in? What? What causes this problem? How to solve it?

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(1)
代言

It is estimated that it is caused by your quoting jquery. I have had similar problems before when I quoted jquery’s third-party plug-in. Try exposing jquery globally.
main.js in:

import jquery  from 'jquery';
global.jquery = global.$ = jquery;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!