vue-class-decorators
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

Vue Class Decorators

This library fully depends on vue-class-component.

License

MIT License

Install

npm i -S vue-class-decorators

Usage

'use strict';
import { Component, prop, watch } from 'vue-class-decorators';
 
@Component({})
export class Component {
    @prop(Number)
    propA: number;
 
    @prop({
      type: String,
      default: 'default value'
    })
    propB: string;
 
    @watch('child')
    onChildChanged(val: string, oldVal: string) {}
}
 

becomes

'use strict'
export const Component = Vue.extend({
    props: {
        propA: Number,
        propB: {
            type: String,
            required: true,
            default: ''
        }
    },
    methods: {
        onChildChanged(val, oldVal) {}
    },
    watch: {
        'child': 'onChildChanged'
    }
})

Package Sidebar

Install

npm i vue-class-decorators

Weekly Downloads

28

Version

1.0.13

License

MIT

Last publish

Collaborators

  • davidgust