把 this._class = 'ActionTransfer' 改为 this._class = this.constructor.name,这才是标准写法,不知道为何ActionTranfer用了字符串。

This commit is contained in:
luk.lu 2019-04-09 09:25:58 +08:00
parent 73ca4df3db
commit e2a0738a80

View File

@ -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