Import Javascript Class In VueJS
I want to use a javascript class in may Vue application. My class looks like: class className { constructor() { ... } function1() { ... } s
Solution 1:
You need to export the class to be able to import/require it
//1. For import syntax
export default class className {...}
//2. For require syntax
class className {}
module.exports.className = className
//or
module.exports = {
className: className
}
Solution 2:
Using import/export
, you'd use
export class className {}
and
import {className} from '<file>';
Post a Comment for "Import Javascript Class In VueJS"