A
A
Alexandra2021-04-20 20:08:39
Vue.js
Alexandra, 2021-04-20 20:08:39

How to include local library in Vue js?

Hello everyone, I don’t have a big local jquery plugin, please tell me how to connect a local lib to the vue cli project? jQuery itself works, the path with the alias is correct.
I try this way, I get an error

import $ from 'jquery'
  import "@/assets/libs/pagenav.js"
  
  export default {
    name: 'WorkList',
    data() {
      return{
        getWorks: getWorks(),
        result: ['1', '2', '3']
      }
    },
    mounted: function() {
        $('.pagination').click(function(){
            alert(1);
        })
        var $vm = this;
        $('.folio').pagenavjs({
            navContainer: '.test',
            pageSize: 1,
            dataSource: $vm.result
        });
    }
  }


Mistake
TypeError: jquery__WEBPACK_IMPORTED_MODULE_1___default()(...).pagenavjs is not a function

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question