|
|
@ -1,5 +1,5 @@ |
|
|
|
;(function () { |
|
|
|
;(function () { |
|
|
|
function initWatch(vm, watch) { |
|
|
|
function initWatch (vm, watch) { |
|
|
|
vm._watchers || (vm._watchers = []); |
|
|
|
vm._watchers || (vm._watchers = []); |
|
|
|
for (var key in watch) { |
|
|
|
for (var key in watch) { |
|
|
|
var handler = watch[key]; |
|
|
|
var handler = watch[key]; |
|
|
@ -13,7 +13,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function createWatcher(vm, keyOrFn, cb, options) { |
|
|
|
function createWatcher (vm, keyOrFn, cb, options) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
|
options = cb; |
|
|
|
options = cb; |
|
|
|
cb = cb.handler; |
|
|
|
cb = cb.handler; |
|
|
@ -27,16 +27,13 @@ |
|
|
|
var target = null; |
|
|
|
var target = null; |
|
|
|
var targetStack = []; |
|
|
|
var targetStack = []; |
|
|
|
|
|
|
|
|
|
|
|
function pushTarget(_target) { |
|
|
|
function pushTarget (_target) { |
|
|
|
if (target) targetStack.push(target); |
|
|
|
if (target) targetStack.push(target); |
|
|
|
Fix.Model.target = target = _target; |
|
|
|
Fix.Model.target = target = _target; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function popTarget () { |
|
|
|
function popTarget () { |
|
|
|
Fix.Model.target = target = targetStack.pop(); |
|
|
|
Fix.Model.target = target = targetStack.pop(); |
|
|
|
if (targetStack.length <= 0) { |
|
|
|
|
|
|
|
Fix.Model.target = target = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var oldWatch = Fix.watch; |
|
|
|
var oldWatch = Fix.watch; |
|
|
@ -56,7 +53,7 @@ |
|
|
|
}, options); |
|
|
|
}, options); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function findStore(widget) { |
|
|
|
function findStore (widget) { |
|
|
|
if (target != null) { |
|
|
|
if (target != null) { |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
@ -122,7 +119,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function createStore() { |
|
|
|
function createStore () { |
|
|
|
var needPop = false; |
|
|
|
var needPop = false; |
|
|
|
if (_global.Fix && this._store) { |
|
|
|
if (_global.Fix && this._store) { |
|
|
|
var store = findStore(this.options.context || this.options.element); |
|
|
|
var store = findStore(this.options.context || this.options.element); |
|
|
@ -231,14 +228,14 @@ |
|
|
|
BI.defer(function () { |
|
|
|
BI.defer(function () { |
|
|
|
additionFunc(); |
|
|
|
additionFunc(); |
|
|
|
}, 200); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
}; |
|
|
|
var back = window.history.back; |
|
|
|
var back = window.history.back; |
|
|
|
window.history.back = function () { |
|
|
|
window.history.back = function () { |
|
|
|
back.apply(this, arguments); |
|
|
|
back.apply(this, arguments); |
|
|
|
BI.defer(function () { |
|
|
|
BI.defer(function () { |
|
|
|
additionFunc(); |
|
|
|
additionFunc(); |
|
|
|
}, 200); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (BI.Router) { |
|
|
|
if (BI.Router) { |
|
|
@ -246,22 +243,22 @@ |
|
|
|
BI.Router.prototype.execute = function () { |
|
|
|
BI.Router.prototype.execute = function () { |
|
|
|
execute.apply(this, arguments); |
|
|
|
execute.apply(this, arguments); |
|
|
|
additionFunc(); |
|
|
|
additionFunc(); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", |
|
|
|
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", |
|
|
|
"sortBy", "groupBy", "indexBy", "countBy", "partition", |
|
|
|
"sortBy", "groupBy", "indexBy", "countBy", "partition", |
|
|
|
"keys", "allKeys", "values", "pairs", "invert", |
|
|
|
"keys", "allKeys", "values", "pairs", "invert", |
|
|
|
"mapObject", "findKey", "pick", "omit", "tap"], function (name) { |
|
|
|
"mapObject", "findKey", "pick", "omit", "tap"], function (name) { |
|
|
|
var old = BI[name]; |
|
|
|
var old = BI[name]; |
|
|
|
BI[name] = function (obj, fn, context) { |
|
|
|
BI[name] = function (obj, fn, context) { |
|
|
|
return typeof fn === "function" ? old(obj, function (key, value) { |
|
|
|
return typeof fn === "function" ? old(obj, function (key, value) { |
|
|
|
if (!(key in Fix.$$skipArray)) { |
|
|
|
if (!(key in Fix.$$skipArray)) { |
|
|
|
return fn.apply(this, arguments); |
|
|
|
return fn.apply(this, arguments); |
|
|
|
} |
|
|
|
} |
|
|
|
}, context) : old.apply(this, arguments); |
|
|
|
}, context) : old.apply(this, arguments); |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.isEmpty = function (ob) { |
|
|
|
BI.isEmpty = function (ob) { |
|
|
|
if (BI.isPlainObject(ob) && ob.__ob__) { |
|
|
|
if (BI.isPlainObject(ob) && ob.__ob__) { |
|
|
|
return BI.keys(ob).length === 0; |
|
|
|
return BI.keys(ob).length === 0; |
|
|
@ -317,7 +314,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
Fix.set = function (obj, k, v) { |
|
|
|
Fix.set = function (obj, k, v) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if(obj) { |
|
|
|
if (obj) { |
|
|
|
obj[k] = v; |
|
|
|
obj[k] = v; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
@ -325,7 +322,7 @@ |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
return _.cloneDeep(obj); |
|
|
|
return _.cloneDeep(obj); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
Fix.del = function (obj, k) { |
|
|
|
Fix.del = function (obj, k) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
delete obj[k]; |
|
|
|
delete obj[k]; |
|
|
@ -334,5 +331,5 @@ |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
return _.cloneDeep(obj); |
|
|
|
return _.cloneDeep(obj); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}()); |
|
|
|
}()); |
|
|
|