gpt4 book ai didi

javascript - 在 ember.js 中将参数传递给 init

转载 作者:行者123 更新时间:2023-12-03 03:20:37 26 4
gpt4 key购买 nike

如何将参数传递给 init() 或访问 ember.js 中 init() 内传递给 create() 的参数

最佳答案

只需使用this.get('theProperty')

示例:

var data = {
foo: "hello",
};

var MyModel = Em.Object.extend({
init: function() {
this._super();
var foo = this.get('foo');
alert(foo);
}
});

MyModel.create(data);

关于javascript - 在 ember.js 中将参数传递给 init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10951513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com