vue / cli3 + typescript watch prop component computed in Usage

    The first step: introduction:

{the Component Import, Prop, Watch, Vue} from 'VUE-Property-Decorator'; 
// Note points: the first letter is capitalized

Step: Usage
1.component
@Component ({ 
Components: {
// component name
}
})
Export default class formall the extends Vue {
2.prop
@Prop () Private visible: = Boolean to false;
// visible data transfer from a parent 

3.computed 
Columns GET Private () { 
// calculated data
}
4.watch 

@Watch ( 'you to listen attributes')
Watchdata (newVal, oldVal) {

the console.log ( "newVal", newVal, "oldVal", oldVal);
// you logical operation processing
};


}

Guess you like

Origin www.cnblogs.com/xiebeibei/p/12174684.html