Created
October 4, 2019 14:54
-
-
Save nolimits4web/99b8334cb09e892024e360ecd4e79593 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myMixin = { | |
data: function() { | |
return { | |
foo: 'bar', | |
} | |
}, | |
mounted: function() { | |
console.log('mounted') | |
} | |
} | |
var component = { | |
// pass mixins | |
mixins: [myMixin], | |
data: function () { | |
// component already have foo: 'bar' in data | |
return { | |
john: 'doe', | |
} | |
}, | |
// component already have mounted hook inherited from mixin | |
// in addition we can add one more mounted hook | |
mounted: function () { | |
console.log('component mounted') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment