|
1 | 1 | /*! |
2 | | - * Vue.js v2.0.7 |
| 2 | + * Vue.js v2.1.0 |
3 | 3 | * (c) 2014-2016 Evan You |
4 | 4 | * Released under the MIT License. |
5 | 5 | */ |
@@ -371,14 +371,20 @@ var nextTick = (function () { |
371 | 371 | } |
372 | 372 |
|
373 | 373 | return function queueNextTick (cb, ctx) { |
374 | | - var func = ctx |
375 | | - ? function () { cb.call(ctx); } |
376 | | - : cb; |
377 | | - callbacks.push(func); |
| 374 | + var _resolve; |
| 375 | + callbacks.push(function () { |
| 376 | + if (cb) { cb.call(ctx); } |
| 377 | + if (_resolve) { _resolve(ctx); } |
| 378 | + }); |
378 | 379 | if (!pending) { |
379 | 380 | pending = true; |
380 | 381 | timerFunc(); |
381 | 382 | } |
| 383 | + if (!cb && typeof Promise !== 'undefined') { |
| 384 | + return new Promise(function (resolve) { |
| 385 | + _resolve = resolve; |
| 386 | + }) |
| 387 | + } |
382 | 388 | } |
383 | 389 | })(); |
384 | 390 |
|
@@ -2829,7 +2835,7 @@ function initRender (vm) { |
2829 | 2835 |
|
2830 | 2836 | function renderMixin (Vue) { |
2831 | 2837 | Vue.prototype.$nextTick = function (fn) { |
2832 | | - nextTick(fn, this); |
| 2838 | + return nextTick(fn, this) |
2833 | 2839 | }; |
2834 | 2840 |
|
2835 | 2841 | Vue.prototype._render = function () { |
@@ -3228,6 +3234,7 @@ function resolveConstructorOptions (Ctor) { |
3228 | 3234 | Ctor.superOptions = superOptions; |
3229 | 3235 | extendOptions.render = options.render; |
3230 | 3236 | extendOptions.staticRenderFns = options.staticRenderFns; |
| 3237 | + extendOptions._scopeId = options._scopeId; |
3231 | 3238 | options = Ctor.options = mergeOptions(superOptions, extendOptions); |
3232 | 3239 | if (options.name) { |
3233 | 3240 | options.components[options.name] = Ctor; |
@@ -3383,20 +3390,44 @@ function initAssetRegisters (Vue) { |
3383 | 3390 | }); |
3384 | 3391 | } |
3385 | 3392 |
|
| 3393 | +/* */ |
| 3394 | + |
| 3395 | +var patternTypes = [String, RegExp]; |
| 3396 | + |
| 3397 | +function matches (pattern, name) { |
| 3398 | + if (typeof pattern === 'string') { |
| 3399 | + return pattern.split(',').indexOf(name) > -1 |
| 3400 | + } else { |
| 3401 | + return pattern.test(name) |
| 3402 | + } |
| 3403 | +} |
| 3404 | + |
3386 | 3405 | var KeepAlive = { |
3387 | 3406 | name: 'keep-alive', |
3388 | 3407 | abstract: true, |
| 3408 | + props: { |
| 3409 | + include: patternTypes, |
| 3410 | + exclude: patternTypes |
| 3411 | + }, |
3389 | 3412 | created: function created () { |
3390 | 3413 | this.cache = Object.create(null); |
3391 | 3414 | }, |
3392 | 3415 | render: function render () { |
3393 | 3416 | var vnode = getFirstComponentChild(this.$slots.default); |
3394 | 3417 | if (vnode && vnode.componentOptions) { |
3395 | 3418 | var opts = vnode.componentOptions; |
| 3419 | + // check pattern |
| 3420 | + var name = opts.Ctor.options.name || opts.tag; |
| 3421 | + if (name && ( |
| 3422 | + (this.include && !matches(this.include, name)) || |
| 3423 | + (this.exclude && matches(this.exclude, name)) |
| 3424 | + )) { |
| 3425 | + return vnode |
| 3426 | + } |
3396 | 3427 | var key = vnode.key == null |
3397 | 3428 | // same constructor may get registered as different local components |
3398 | 3429 | // so cid alone is not enough (#3269) |
3399 | | - ? opts.Ctor.cid + '::' + opts.tag |
| 3430 | + ? opts.Ctor.cid + (opts.tag ? ("::" + (opts.tag)) : '') |
3400 | 3431 | : vnode.key; |
3401 | 3432 | if (this.cache[key]) { |
3402 | 3433 | vnode.child = this.cache[key].child; |
@@ -3464,7 +3495,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', { |
3464 | 3495 | get: isServerRendering |
3465 | 3496 | }); |
3466 | 3497 |
|
3467 | | -Vue$2.version = '2.0.7'; |
| 3498 | +Vue$2.version = '2.1.0'; |
3468 | 3499 |
|
3469 | 3500 | /* */ |
3470 | 3501 |
|
|
0 commit comments