fix: key -> cacheKey

This commit is contained in:
yison 2019-03-18 21:08:30 +08:00
parent 4d6d3e26d4
commit 8a657318fc

View file

@ -145,7 +145,7 @@
type: String, type: String,
default: '' default: ''
}, },
key: { cacheKey: {
type: String, type: String,
default: '' default: ''
}, },
@ -239,8 +239,8 @@
]; ];
}, },
pageSizeKey() { pageSizeKey() {
if (this.cachePageSize && this.key !== null) { if (this.cachePageSize && this.cacheKey !== null) {
return `pageSize_${this.key}`; return `pageSize_${this.cacheKey}`;
} else { } else {
return null; return null;
} }
@ -288,7 +288,7 @@
this.currentPageSize = pageSize; this.currentPageSize = pageSize;
this.$emit('on-page-size-change', pageSize); this.$emit('on-page-size-change', pageSize);
this.changePage(1); this.changePage(1);
if (this.cachePageSize && this.key !== null) { if (this.cachePageSize && this.cacheKey !== null) {
window.localStorage.setItem(this.pageSizeKey, pageSize); window.localStorage.setItem(this.pageSizeKey, pageSize);
} }
}, },
@ -328,7 +328,7 @@
} }
}, },
mounted () { mounted () {
if (this.cachePageSize && this.key !== null) { if (this.cachePageSize && this.cacheKey !== null) {
const pageSize = window.localStorage.getItem(this.pageSizeKey); const pageSize = window.localStorage.getItem(this.pageSizeKey);
if (this.pageSizeOpts.includes(pageSize)) { if (this.pageSizeOpts.includes(pageSize)) {
this.currentPageSize = pageSize; this.currentPageSize = pageSize;