nuxt-community / nuxt-property-decorator

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

New fetchDelay hook for Nuxt >=2.12 #96

Open FaitAccompli opened 2 years ago

FaitAccompli commented 2 years ago

Just like issue (https://github.com/nuxt-community/nuxt-property-decorator/issues/72). Nuxt 2.12+ introduces a new option called fetchDelay.

As per documentation (https://nuxtjs.org/docs/components-glossary/fetch/#options): fetchDelay is a variable of type integer with a default value of 200, set the minimum executing time in milliseconds (to avoid quick flashes)

The temporary workaround for example and is based on #72 is:

Component.registerHooks(['fetchDelay']);

@Component
export default class MyComponent extends Vue {
  fetchDelay() { return 1000 }; //for 1 second
}

I would like to request if we can add support for fetchDelay as a function.