Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nuxt-property-decorator

> 前端框架
Open source

Property decorators for Nuxt (base on vue-property-decorator)

397 stars0 likes1 views
WebsiteGitHub

About

Property decorators for Nuxt (base on vue-property-decorator)

Nuxt Property Decorator

Handy ES / TypeScript decorators for class-style Vue components in Nuxt (based on Vue class component) and Property decorators for Vue (bases on Vue Property Decorator) and Vuex (based on Vuex Class)

This library fully depends on vue-class-component.

License

MIT License

Install

Installation is very easy

bash
npm i -S nuxt-property-decorator

or

bash
yarn add nuxt-property-decorator

Nuxt JS Instructions

It works out of the box with Nuxt JS.

Nuxt TS Instructions

It works out of the box with Nuxt TS.

Decorators and helpers

There are following decorators:

  • Nuxt specific decorators

    • @Off - decorator of $off
    • @On- decorator of $on
    • @Once- decorator of $once
    • @NextTick -decorator of $nextTick
  • exported from vue-class-component

    • @Component
  • exported from vue-property-decorator

    • @Emit
    • @Inject
    • @InjectReactive
    • @Model
    • @ModelSync
    • @Prop
    • @PropSync
    • @Provide
    • @ProvideReactive
    • @Ref
    • @VModel
    • @Watch
  • exported from vuex-class

    • @State
    • @Getter
    • @Action
    • @Mutation
  • exported from vuex-module-decorators

    • Module,
    • getModule,
    • VuexModule,
    • VuexMutation (Mutation from original renamed to avoid conflict with 'vuex-class' one),
    • MutationAction,
    • VuexAction (Action from original renamed to avoid conflict with 'vuex-class' one),

Other exports

  • namespace
  • mixins
  • Vue

Hooks

Vue Router hooks

  • beforeRouteEnter
  • beforeRouteUpdate
  • beforeRouteLeave

Nuxt hooks

  • asyncData
  • fetch
  • fetchOnServer
  • head
  • key
  • layout
  • loading
  • middleware
  • scrollToTop
  • transition
  • validate
  • watchQuery
  • meta

Vue-class Hooks

  • data
  • beforeCreate
  • created
  • beforeMount
  • mounted
  • beforeDestroy
  • destroyed
  • beforeUpdate
  • updated
  • activated
  • deactivated
  • render
  • errorCaptured
  • serverPrefetch

Usage

…

is equivalent to

…

As you can see at propA and propB, the type can be inferred automatically when it's a simple type. For more complex types like enums you do need to specify it specifically. Also this library needs to have emitDecoratorMetadata set to true for this to work.

Useful links

See also:

  • Vue Property Decorator
  • Vue class component
  • Vuex Class
  • Nuxt Class Component

Issues· 15 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptnuxtnuxt-decoratorsvuevue-decorators

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架