vue-property-decorator-extended
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Vue Property Decorator

This library fully depends on vue-class-component.

License

MIT License

Install

npm i -S vue-property-decorator

Usage

'use strict';
import { Component, prop, watch } from 'vue-property-decorator';
 
@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-property-decorator-extended

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • davidgust