mixins
-
Type:
Array
-
Details:
The
mixins
option accepts an array of mixin objects. These mixin objects can contain instance options just like normal instance objects, and they will be merged against the eventual options using the same option merging logic inVue.extend()
. e.g. If your mixin contains a created hook and the component itself also has one, both functions will be called.Mixin hooks are called in the order they are provided, and called before the component’s own hooks.
-
Example:
var mixin = { created: function () { console.log(1) } } var vm = new Vue({ created: function () { console.log(2) }, mixins: [mixin] }) // -> 1 // -> 2
-
See also: Mixins
Please login to continue.