Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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')
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement