[Vuejs]-How to load static script files in Vue CLI 3

0👍

Let’s integrate jQuery with Vue.js

1. install jQuery

$ npm install jquery --save

2. check your package.json

Here is how it looks like. it will be added jquery library with specific version.

"dependencies": {
  "jquery": "^3.4.1"
}

3. define jQuery in your vue component.

<template>
 <!-- HTML markup in here -->
</template>
<script>
window.$ = window.jQuery = window.jquery = require('jquery')

export default {
  name: 'component name'
}
</script>

Leave a comment