Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Add Support for loading fromMobx attributes from mixins on components. #21

Merged
merged 1 commit into from
Mar 16, 2018

Conversation

Tresky
Copy link
Contributor

@Tresky Tresky commented Mar 14, 2018

The current functionality of the library does not allow loading fromMobx attributes from a mixin on a component. See example below:

const data = observable({
  foo: 1
})

const mixin = {
  fromMobx: {
    foo () {
      return data.foo
    }
  }
}

const vm = new Vue({
  mixins: [mixin],
  computed: {
    value () {
      // This value will be undefined in the current version.
      return this.foo
    }
  },
  render (h) {
    const vm: any = this
    return h('div', `${vm.value}`)
  }
})

As it stands, right now, the value foo will not be defined in the top-level component. This pull request pulls fromMobx attributes from mixins one-level below the top-level component to allow Movue to be used in mixin abstraction.

@nighca
Copy link
Owner

nighca commented Mar 16, 2018

Good catch, Thanks!

@nighca nighca merged commit a6bdc84 into nighca:master Mar 16, 2018
@Tresky Tresky deleted the add-mixin-support branch March 16, 2018 16:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants