|
|
@ -17,7 +17,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout; |
|
|
|
var requestAnimationFrame = _global.requestAnimationFrame || _global.webkitRequestAnimationFrame || _global.mozRequestAnimationFrame || _global.oRequestAnimationFrame || _global.msRequestAnimationFrame || _global.setTimeout; |
|
|
|
|
|
|
|
|
|
|
|
function callLifeHook (self, life) { |
|
|
|
function callLifeHook(self, life) { |
|
|
|
var hooks = [], hook; |
|
|
|
var hooks = [], hook; |
|
|
|
hook = self[life]; |
|
|
|
hook = self[life]; |
|
|
|
if (hook) { |
|
|
|
if (hook) { |
|
|
@ -124,7 +124,7 @@ |
|
|
|
var initCallbackCalled = false; |
|
|
|
var initCallbackCalled = false; |
|
|
|
var renderCallbackCalled = false; |
|
|
|
var renderCallbackCalled = false; |
|
|
|
|
|
|
|
|
|
|
|
function init () { |
|
|
|
function init() { |
|
|
|
// 加个保险
|
|
|
|
// 加个保险
|
|
|
|
if (initCallbackCalled === true) { |
|
|
|
if (initCallbackCalled === true) { |
|
|
|
_global.console && console.error("组件: 请检查beforeInit内部的写法,callback只能执行一次"); |
|
|
|
_global.console && console.error("组件: 请检查beforeInit内部的写法,callback只能执行一次"); |
|
|
@ -132,7 +132,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
initCallbackCalled = true; |
|
|
|
initCallbackCalled = true; |
|
|
|
|
|
|
|
|
|
|
|
function render () { |
|
|
|
function render() { |
|
|
|
// 加个保险
|
|
|
|
// 加个保险
|
|
|
|
if (renderCallbackCalled === true) { |
|
|
|
if (renderCallbackCalled === true) { |
|
|
|
_global.console && console.error("组件: 请检查beforeRender内部的写法,callback只能执行一次"); |
|
|
|
_global.console && console.error("组件: 请检查beforeRender内部的写法,callback只能执行一次"); |
|
|
@ -246,8 +246,8 @@ |
|
|
|
return getter.call(self, self); |
|
|
|
return getter.call(self, self); |
|
|
|
}, (handler && function (v) { |
|
|
|
}, (handler && function (v) { |
|
|
|
handler.call(self, self, v); |
|
|
|
handler.call(self, self, v); |
|
|
|
}) || BI.emptyFn, BI.extend({deep: true}, options)); |
|
|
|
}) || BI.emptyFn, BI.extend({ deep: true }, options)); |
|
|
|
this._watchers.push(function unwatchFn () { |
|
|
|
this._watchers.push(function unwatchFn() { |
|
|
|
watcher.teardown(); |
|
|
|
watcher.teardown(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return watcher.value; |
|
|
|
return watcher.value; |
|
|
@ -346,6 +346,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
_initState: function () { |
|
|
|
_initState: function () { |
|
|
|
this._isMounted = false; |
|
|
|
this._isMounted = false; |
|
|
|
|
|
|
|
this._isDestroyed = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
__initWatch: function () { |
|
|
|
__initWatch: function () { |
|
|
@ -449,6 +450,10 @@ |
|
|
|
return this._isMounted; |
|
|
|
return this._isMounted; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isDestroyed: function () { |
|
|
|
|
|
|
|
return this._isDestroyed; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setWidth: function (w) { |
|
|
|
setWidth: function (w) { |
|
|
|
this.options.width = w; |
|
|
|
this.options.width = w; |
|
|
|
this._initElementWidth(); |
|
|
|
this._initElementWidth(); |
|
|
@ -681,11 +686,11 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isEnabled: function () { |
|
|
|
isEnabled: function () { |
|
|
|
return this.options.disabled === true ? false: !this.options._disabled; |
|
|
|
return this.options.disabled === true ? false : !this.options._disabled; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isValid: function () { |
|
|
|
isValid: function () { |
|
|
|
return this.options.invalid === true ? false: !this.options._invalid; |
|
|
|
return this.options.invalid === true ? false : !this.options._invalid; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isVisible: function () { |
|
|
|
isVisible: function () { |
|
|
@ -732,6 +737,7 @@ |
|
|
|
this._isMounted = false; |
|
|
|
this._isMounted = false; |
|
|
|
callLifeHook(this, "destroyed"); |
|
|
|
callLifeHook(this, "destroyed"); |
|
|
|
this.destroyed = null; |
|
|
|
this.destroyed = null; |
|
|
|
|
|
|
|
this._isDestroyed = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_unMount: function () { |
|
|
|
_unMount: function () { |
|
|
@ -825,12 +831,12 @@ |
|
|
|
BI.Widget.context = context = contextStack.pop(); |
|
|
|
BI.Widget.context = context = contextStack.pop(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function pushTarget (_current) { |
|
|
|
function pushTarget(_current) { |
|
|
|
if (current) currentStack.push(current); |
|
|
|
if (current) currentStack.push(current); |
|
|
|
BI.Widget.current = current = _current; |
|
|
|
BI.Widget.current = current = _current; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function popTarget () { |
|
|
|
function popTarget() { |
|
|
|
BI.Widget.current = current = currentStack.pop(); |
|
|
|
BI.Widget.current = current = currentStack.pop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|