mirror of https://github.com/vuejs/vue.git
use directive._checkParam everywhere
This commit is contained in:
parent
2eee405cc1
commit
57d81efe78
|
|
@ -21,8 +21,15 @@ module.exports = {
|
|||
// create a ref anchor
|
||||
this.ref = document.createComment('v-component')
|
||||
_.replace(this.el, this.ref)
|
||||
// check keep-alive options
|
||||
this.checkKeepAlive()
|
||||
// check keep-alive options.
|
||||
// If yes, instead of destroying the active vm when
|
||||
// hiding (v-if) or switching (dynamic literal) it,
|
||||
// we simply remove it from the DOM and save it in a
|
||||
// cache object, with its constructor id as the key.
|
||||
this.keepAlive = this._checkParam('keep-alive') != null
|
||||
if (this.keepAlive) {
|
||||
this.cache = {}
|
||||
}
|
||||
// compile parent scope content
|
||||
this.parentLinkFn = compile(
|
||||
this.el, this.vm.$options,
|
||||
|
|
@ -47,23 +54,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the "keep-alive" flag is present.
|
||||
* If yes, instead of destroying the active vm when
|
||||
* hiding (v-if) or switching (dynamic literal) it,
|
||||
* we simply remove it from the DOM and save it in a
|
||||
* cache object, with its constructor id as the key.
|
||||
*/
|
||||
|
||||
checkKeepAlive: function () {
|
||||
// check keep-alive flag
|
||||
this.keepAlive = this.el.hasAttribute('keep-alive')
|
||||
if (this.keepAlive) {
|
||||
this.el.removeAttribute('keep-alive')
|
||||
this.cache = {}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resolve the component constructor to use when creating
|
||||
* the child vm.
|
||||
|
|
|
|||
|
|
@ -8,15 +8,9 @@ module.exports = {
|
|||
|
||||
// check params
|
||||
// - lazy: update model on "change" instead of "input"
|
||||
var lazy = el.hasAttribute('lazy')
|
||||
if (lazy) {
|
||||
el.removeAttribute('lazy')
|
||||
}
|
||||
var lazy = this._checkParam('lazy') != null
|
||||
// - number: cast value into number when updating model.
|
||||
var number = el.hasAttribute('number')
|
||||
if (number) {
|
||||
el.removeAttribute('number')
|
||||
}
|
||||
var number = this._checkParam('number') != null
|
||||
|
||||
// handle composition events.
|
||||
// http://blog.evanyou.me/2014/01/03/composition-event/
|
||||
|
|
|
|||
Loading…
Reference in New Issue