+34
-5
lines changedFilter options
+34
-5
lines changed Original file line number Diff line number Diff line change
@@ -71,13 +71,13 @@ export default {
71
71
}
72
72
},
73
73
74
-
watch: {
75
-
include (val: string | RegExp | Array<string>) {
74
+
mounted () {
75
+
this.$watch('include', val => {
76
76
pruneCache(this, name => matches(val, name))
77
-
},
78
-
exclude (val: string | RegExp | Array<string>) {
77
+
})
78
+
this.$watch('exclude', val => {
79
79
pruneCache(this, name => !matches(val, name))
80
-
}
80
+
})
81
81
},
82
82
83
83
render () {
Original file line number Diff line number Diff line change
@@ -393,6 +393,35 @@ describe('Component keep-alive', () => {
393
393
}).then(done)
394
394
})
395
395
396
+
it('prune cache on include/exclude change + view switch', done => {
397
+
const vm = new Vue({
398
+
template: `
399
+
<div>
400
+
<keep-alive :include="include">
401
+
<component :is="view"></component>
402
+
</keep-alive>
403
+
</div>
404
+
`,
405
+
data: {
406
+
view: 'one',
407
+
include: 'one,two'
408
+
},
409
+
components
410
+
}).$mount()
411
+
412
+
vm.view = 'two'
413
+
waitForUpdate(() => {
414
+
assertHookCalls(one, [1, 1, 1, 1, 0])
415
+
assertHookCalls(two, [1, 1, 1, 0, 0])
416
+
vm.include = 'one'
417
+
vm.view = 'one'
418
+
}).then(() => {
419
+
assertHookCalls(one, [1, 1, 2, 1, 0])
420
+
// two should be pruned
421
+
assertHookCalls(two, [1, 1, 1, 1, 1])
422
+
}).then(done)
423
+
})
424
+
396
425
it('should not prune currently active instance', done => {
397
426
const vm = new Vue({
398
427
template: `
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4