vue-property-decorator
vue-property-decorator copied to clipboard
[Feature Request] @Private decorator for private member within typescript class style component ?
i am writing typescript class style vue component. is there any decorator can mark a member private ? it may looks like:
export default class Human extends Vue {
@Private private name:string;
}
i expect this decorator can ensure:
- the marked member can not be set within vue template, such as
<input v-model="name" />
- the marked member can be read within vue template, such as
{{ name }}
- the marked member can be read/set within Human class itself ,such as
this.name = 'bruce'
- compiler can throw error if it's referenced by a wrong name or assigned with a value of different data type. for example:
- typescript compiler will complain
member nAme doesn't exist
when user try to readthis.nAme
, - typescript compiler will complain
member name is of type string but assigned with a number
when user try tothis.name=1
.
- typescript compiler will complain
May be try :
@Prop() private name: string;
?
@Prop()
annotated members are expected to and can indeed be changed by parent components (outside of enclosing class), this breaks rule #1
@yeria-t