@Component
export class ModalDemo extends Vue {
private count!:string;
@Prop() operateForm!: any;
created() {
this.form = this.$form.createForm(this, { name: 'form' });
console.log('this.', this.operateForm);
serviceDemo.getData3(this.operateForm).subscribe((res: any) => {
console.log('res', res);
this.count = res.code;
});
}
render() {
return (
<div>
{this.count}
</div>
);
}
}
一开始这样写的时候,this.count总是赋值不上去,到最后才知道是定义count的时候没有赋初始值,只要在定义count的时候改成private count:string=’ ';