2021-06-27 22:06:11 +08:00

27 lines
573 B
TypeScript

import DeleteRule from "./rules/DeleteRule";
import InsertRule from "./rules/InsertRule";
import SerializationRule from "./rules/SerializationRule";
export default class RuleObj {
type: string;
message: string;
/**
* 具体参数
*/
data: any;
constructor(data: any) {
this.type = data.type;
this.message = data.message;
switch (this.type) {
case "delete":
this.data = new DeleteRule(data.data);
break;
case "insert":
this.data = new InsertRule(data.data);
break;
default:
this.data = new SerializationRule(data.data);
}
}
}