diff --git a/ActionTransfer.js b/ActionTransfer.js index 1be5793..3b570fb 100644 --- a/ActionTransfer.js +++ b/ActionTransfer.js @@ -1,9 +1,9 @@ const Action = require('./Action.js') const DAD = module.exports = function ActionTransfer (prop) { - this._class = 'ActionTransfer' + this._class = this.constructor.name this.setProp(prop) // 没有定义 ActionTransfer.prototype._model,因此继承了上级Action.prototype._model,因此通过this.setProp,继承了上级Action定义的实例自有数据。另一个方案是,调用 Action.call(this, prop) - this.type = 'ActionTransfer' + this.type = this.constructor.name } DAD.__proto__ = Action const MOM = DAD.prototype