Cleanly configure your Vue application as it boots
Installation
An initializer is a JavaScript file placed under /src/initializers
in your
application. You can use initializers to hold configuration settings that run as
your application boots.
npm install --save vue-initializers
Install VueInitializers
as early as possible in your src/main.js
file:
;; Vue; ; ;
Usage
Initializers should export a function which accepts Vue
as a parameter. A
common use case for initializers is to hold initialization code for other
plugins:
; { Vue;}
Sometimes you may want to force an initializer to run before others. In that
case, return an object with a handler
property and one of index
, before
or
after
:
; // Provide another initializer's filename to ensure this runs before. // before: '' // Or provide one to ensure this runs after. // after: '' // Alternatively, pass an index to give an exact position in the run order. // `index: 0` ensures this initializer loads first. index: 0 { ; };