[Vuejs]-The global variable is not working with VueJS & Laravel

0👍

To create a "global variable" to be used in Vue, see LinusBorg’s answer on the Vue forums here: https://forum.vuejs.org/t/global-variable-for-vue-project/32510/4

Contents of the post:

It’s not a good idea to use tru global variables in projects, to keep the global namespace clean.

Instead, create a small file, from where you can export any variable that you need to use in many places:

// variables.js
export const myVar = 'This is my variable'
export const settings = {
  some: 'Settings'
}
// in your Vue
import { myVar, Settings } from './variables.js'

Leave a comment