0👍
firstly, you need to import/require the external file into to the vue component
component.js
const external = require('../to/external_lib.min.js');
... declare Vue component as normal
for importing external CSS;
or say importing css into the component, you’ll need to change your webpack config by adding css-loader
and style-loader
(i.e. npm i --save css-loader style-loader
);
afterwards in your component.js
component.js
const external = require('../to/external_lib.min.js');
import '../to/component.css';
... declare Vue component as normal
without more information as to say, your js file, or your project setup, i can not give more detailed information.
- [Vuejs]-Computed property other file
- [Vuejs]-How to avoid accessing vue instance in multiple JavaScript files?
Source:stackexchange.com