vue-class-component: Doesn't work with Nuxt

I use Nuxt and I try to use class-component, I installed the plugin:

{
  "plugins": [
    "transform-decorators-legacy",
    "transform-class-properties"
  ]
}

also I tried add in inside nuxt.config

build: {
      vendor: ['vue-class-component'],
      babel: {
        plugins: [
          'transform-decorators-legacy',
          'transform-class-properties'
        ]
      }
    }

but nothing works, What I do incorrect?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Thank you for describing the detail @Atinux

Actually, vue-class-component already has an interface to configure the hooks. https://github.com/vuejs/vue-class-component#adding-custom-hooks In addition, as the @Component decorator can receive all possible component options, we also can put asyncData and fetch into the decorator.

@Component({
  asyncData () { ... },
  fetch () { ... }
})
class MyComp extends Vue {
  // ...
}

I remember that the nuxt’s data is now renamed to asyncData, so that is not a problem since we can configure the hooks in vue-class-component?

It’s now working with the last release of Nuxt.js (0.10.6)!

Example: https://github.com/nuxt/nuxt.js/tree/master/examples/vue-class-component

You can close the issue 😃