Global Methods
Vue.extend( options )
- options
Object
Create a subclass of the Vue class. Most instantiation options can be used here, with the exception of the el
option because you can’t create multiple ViewModel instances on the same element. Also see Composing ViewModels.
Example
1 | var Profile = Vue.extend({ |
Will result in:
1 | <p>Walter White aka Heisenberg</p> |
Vue.config( options | key, [value] )
- options
Object
- key
String
- value
*
optional
Configure global settings. This function is overloaded:
1 | // get the `debug` value |
Here are all the options with their default values:
1 | { |
Vue.directive( id, [definition] )
- id
String
- definition
Function
orObject
optional
Register or retrieve a global custom directive. For more details see Writing Custom Directives.
Vue.filter( id, definition )
- id
String
- definition
Function
optional
Register or retrieve a global custom filter. For more details see Writing Custom Filters.
Vue.component( id, definition )
- id
String
- definition
Function Constructor
orObject
optional
Register or retrieve a global component. For more details see Composing ViewModels.
Vue.effect( id, definition )
- id
String
- definition
Object
optional
Register or retrieve a global JavaScript transition effect definition. For more details see Adding Transition Effects.
Vue.partial( id, definition )
- id
String
- definition
String
orHTMLElement
optional
Register or retrieve a global partial. The definition can be a template string, a querySelector that starts with #
, or a DOM element (whose innerHTML will be used as the template string.)
Example
HTML
1 | <div id="demo"> |
JavaScript
1 | Vue.partial('avatar', '<img v-attr="src:avatarURL">') |
Will result in:
1 | <div id="demo"> |
Vue.nextTick( callback )
- callback
Function
Vue.js batches view updates and executes them all asynchronously. It uses requestAnimationFrame
if available and falls back to setTimeout(fn, 0)
. This method calls the callback after the next view update, which can be useful when you want to wait until the view has been updated.
Vue.require( module )
- module
String
Get access to Vue.js’ internal modules. This is intended for plugin authors and only the following modules are exposed:
utils
config
transition
observer
.
Vue.use( plugin, [args…] )
- plugin
Object
orFunction
- 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.