Model文件
define(function() {
return Backbone.Model.extend({
url:function(){
console.log(this.id);//这个值可以输出
console.log(this.btnType);//这个值却不能
return "data/goods/" + this.id+ this.btnType+ "/skudata.php"
}
});
})
问题:为什么可以输出id,id外的参数无法获取
this.get("btnType") 问题解决
或者
this.model.fetch({
data: {
id : 555555,
btnType : 123
}
});
获取url是在什么时候,model set的话应该在view里面绑定一个change事件再去获取url试试呢