nuxt-community / nuxt-property-decorator

Property decorators for Nuxt (base on vue-property-decorator)
https://github.com/kaorun343/vue-property-decorator
MIT License
400 stars 34 forks source link

Nuxt Hook not registering #81

Closed MoronixProduct3 closed 5 months ago

MoronixProduct3 commented 3 years ago

Description

In the following sample, the middleware Nuxt hook isn't being picked up. middleware is listed amongst the list of supported Nuxt hooks.

import { Component, Vue } from "nuxt-property-decorator"

@Component
export default class CreateUserDialog extends Vue {
  middleware = 'redirect' // This hook is ignored and a `data` field is registered
}

Workaround

Pass the hook directly to the underlying object

import { Component, Vue } from "nuxt-property-decorator"

@Component ({ middleware: 'redirect'})
export default class CreateUserDialog extends Vue {
  ...
}
husayt commented 3 years ago

@MoronixProduct3 can I ask you to check something for me?

Add this to one your client side plugins (preferably, those called earlier)

import "nuxt-property-decorator"

Does it get resolved ?