avalonJS里avalon.define = function(id, factory) { var $id = id.$id || id if (!$id) { log("warning: vm必须指定$id") } if (VMODELS[$id]) { log("warning: " + $id + " 已经存在于avalon.vmodels中") } if (typeof id === "object") { var model = modelFactory(id) } else { var scope = { $watch: noop } factory(scope) //得到所有定义 model = modelFactory(scope) //偷天换日,将scope换为model stopRepeatAssign = true factory(model) stopRepeatAssign = false } model.$id = $id return VMODELS[$id] = model}请问factory这个参数有啥作用?
添加回答
举报
0/150
提交
取消