vue-property-decorator-extended
v1.0.0
Published
property decorators for Vue Component
Downloads
3
Readme
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'
}
})