qh-vue-property-decorator
v3.2.1
Published
property decorators for Vue Component
Downloads
3
Readme
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'
}
})