把 this._class = 'ActionTransfer' 改为 this._class = this.constructor.name,这才是标准写法,不知道为何ActionTranfer用了字符串。
This commit is contained in:
parent
73ca4df3db
commit
e2a0738a80
@ -1,9 +1,9 @@
|
|||||||
const Action = require('./Action.js')
|
const Action = require('./Action.js')
|
||||||
|
|
||||||
const DAD = module.exports = function ActionTransfer (prop) {
|
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.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
|
DAD.__proto__ = Action
|
||||||
const MOM = DAD.prototype
|
const MOM = DAD.prototype
|
||||||
|
Loading…
Reference in New Issue
Block a user