阅读背景:

如何在模型上实现打字稿上的新字段?

来源:互联网 

I create test.model.ts:

我创建test.model.ts:

export interface IPosting {
    text: string;
    docDate: string;
    isDebit: boolean;
    amount: number;
    debitAmount: string;
    creditAmount: string;
}

export class Posting implements IPosting {
    text: string;
    docDate: string;
    isDebit: boolean;
    amount: number;
    debitAmount: string;
    creditAmount: string;

    constructor(text: string, docDate: string, isDebit: boolean, amount: number) {
        this.text = text;
        this.docDate = docDate;
        this.isDebit = isDebit;
        this.amount = amount;
        this.debitAmount = (isDebit) ? this.amount.toString() : '';
        this.creditAmount = (isDebit) ? '' : this.amount.toString();
    }
}
e



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: