Browse Source

include local tag in keep-alive cache key (fix #3269)

dev
Evan You 8 years ago
parent
commit
bff94f3120
  1. 11
      src/core/components/keep-alive.js

11
src/core/components/keep-alive.js

@ -14,12 +14,15 @@ export default {
const rawChild = this.child
const realChild = getRealChild(this.child)
if (realChild && realChild.componentOptions) {
const cid = realChild.componentOptions.Ctor.cid
if (this.cache[cid]) {
const child = realChild.child = this.cache[cid].child
const opts = realChild.componentOptions
// same constructor may get registered as different local components
// so cid alone is not enough (#3269)
const key = opts.Ctor.cid + '::' + opts.tag
if (this.cache[key]) {
const child = realChild.child = this.cache[key].child
realChild.elm = this.$el = child.$el
} else {
this.cache[cid] = realChild
this.cache[key] = realChild
}
realChild.data.keepAlive = true
}

Loading…
Cancel
Save