How to import js file in the Vue component?

devquora
devquora

Posted On: Feb 22, 2018

 

There are two ways to import a JavaScript library to the Vue Component.

The first is to import a local JavaScript library. Here, you can import the JavaScript library by using the 'import' keyword inside the script tag of your Vue file.

import * as mykey from '../assets/js/mykey.js';

The second way is to include your external JavaScript file into the mounted hook of your Vue component.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Vue.js Interview Questions

    What is Vue.js?

    Vue js is progressive javascript script used to create dynamic user interfaces.Vue js is very easy to learn.In order to..

    Vue.js Interview Questions

    List some features of Vue.js.

    Vue js comes with following features Templates Reactivity Components Transitions Routing ..

    Vue.js Interview Questions

    Explain Life cycle of Vue Instance.

    The Life cycle of each Vue instance goes through a series of initialization steps when it is created. – for example, ..