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

3.2.1 • Public • Published

Vue Property Decorator

This library fully depends on vue-class-component.

qh: add @NoCache

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) {}
}

is equivalent to

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

Readme

Keywords

Package Sidebar

Install

npm i qh-vue-property-decorator

Weekly Downloads

0

Version

3.2.1

License

MIT

Last publish

Collaborators

  • noteon