Vue.config is an object containing Vue’s global settings. Here are the list of all the avaiable settings with their default values:
You can modify them directly, for example:
Vue.config.debug = true // turn on debugging mode
Vue.config.debug is set to true, Vue will:
- Print stack traces for all warnings.
- Make all anchor nodes visible in the DOM as Comment nodes. This makes it easier to inspect the structure of the rendered result.
debug mode is not available in the minified production builds.
By default, Vue components inherit all assets from both the class inheritance chain (via
Vue.extend) AND their parents in the view hierarchy. In strict mode, components will only be able to inherit assets from the class inheritance chain, but NOT from their parents in the view hierarchy. When strict mode is enabled, assets should be either registered globally, or explicitly depended on by the component that needs them. When enforced, this could result in better component encapsulation and reusability in larger projects.
When the delimiters are set for text interpolation, the delimiters for HTML interpolation will be generated by adding one outer-most symbol on both sides:
Vue.config.delimiters = ['(%', '%)']
Vue.extend( options )
Create a “subclass” of the base Vue constructor. All instantiation options can be used here. The special cases to note here are
data, which must be functions in this case.
Vue.extend() is called on all component options before instantiating the components. For more details regarding components, see Component System.
// create reusable constructor
Will result in:
<p>Walter White aka Heisenberg</p>
Vue.nextTick( callback )
Defer the callback to be executed after the next DOM update cycle. Use it immediately after you’ve changed some data to wait for the DOM update. For more details see Understanding Async Updates.
Vue.directive( id, [definition] )
Register or retrieve a global custom directive. For more details see Writing Custom Directives.
Vue.elementDirective( id, [definition] )
Register or retrieve a global custom element directive. For more details see Element Directives.
Vue.filter( id, [definition] )
Register or retrieve a global custom filter. For more details see Writing Custom Filters.
Vue.component( id, [definition] )
Register or retrieve a global component. For more details see Component System.
Vue.transition( id, [definition] )
Vue.partial( id, [partial] )
Register or retrieve a global template partial string. For more details see Partial.
Vue.use( plugin, [args…] )
- args… optional
Mount a Vue.js plugin. If the plugin is an Object, it must have an
install method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument. For more details, see Plugins.
Vue.mixin( mixin )
Apply a mixin globally, which affects every Vue instance created afterwards. This can be used by plugin authors to inject custom behavior into components. Not recommended in application code.
Exposes the internal
util module, which contains a number of utility methods. This is intended for advanced plugin/directive authoring, so you will need to look at the source code to see what’s available.