mobxjs / mobx-vue

🐉 Vue bindings for MobX
MIT License
475 stars 22 forks source link

I got error when I use @Observer before @Component with Nuxtjs #32

Open Him-2C opened 5 years ago

Him-2C commented 5 years ago

I use Nuxt + typescript and run with 'universal' mode.

I got error when I refresh browser with this code

@Observer
@Component()
export default class Home extends Vue {
  mounted () {
  }
}

Is don't have any error when I try with

export default observer({
  mounted () {
  }
});

error TypeError: Cannot convert undefined or null to object at Function.getOwnPropertyNames () at Home.Component._init (vendors.app.js:2672) at Home.Vue (commons.app.js:16802) at new Home (inspire.js:64) at collectDataFromConstructor (vendors.app.js:2692) at data (vendors.app.js:2767) at collectData (inspire.js:28) at VueComponent.data (inspire.js:111) at VueComponent.Component.options.data (app.js:3171) at getData (commons.app.js:16467)

kuitos commented 5 years ago

Could u pls provide a minimum reproduction with codesandbox?

Him-2C commented 5 years ago

https://codesandbox.io/s/github/Him-2C/nuxt-typescript-check-mobx

@kuitos

In page/index.vue

Him-2C commented 5 years ago

https://github.com/Him-2C/nuxt-typescript-check-mobx

Him-2C commented 4 years ago

solved with

image