How to introduce js? into vue globally

common.js will have many functions that I define myself, such as:

export function a(){
    //
}
export function b(){
    //
}
export function c(){
    //
}

I will quote him in ad.vue:

import {a} from "@/assets/js/common.js"

I will quote him in role.vue:

import {b} from "@/assets/js/common.js"

N pages need to use functions in common.js. It"s troublesome for me to quote them one by one. Is there a good solution?

< hr >

I tried to introduce common in main.js

import "@/assets/js/common.js"

but this method does not work, it will prompt XX is not defined


me, too, not even on App.vue ~ ~ can only be written in


webpack. There is a global keyword that defines global properties.
the property method defined by this keyword can be used directly in the global file. I have tried the method adopted by


, which is the way of export multiple functions, but the way of using Vue.prototype.$a=a does not seem to work. You will not find $a


can be attached to the Vue prototype.
such as: Vue.prototype.$a=a
use: this.$a

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bedfd7-39f7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bedfd7-39f7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?