mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-03-16 22:10:27 +00:00
avoiding mutating prop mdPageOptions (fix #830)
This commit is contained in:
parent
50e4bbf5dc
commit
567440a584
1 changed files with 10 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<div class="md-table-pagination">
|
||||
<span class="md-table-pagination-label">{{ mdLabel }}:</span>
|
||||
|
||||
<md-select v-model="currentSize" md-menu-class="md-pagination-select" @change="changeSize" v-if="mdPageOptions">
|
||||
<md-select v-model="currentSize" md-menu-class="md-pagination-select" @change="changeSize" v-if="mdPageOptions !== false">
|
||||
<md-option v-for="amount in mdPageOptions" :key="amount" :value="amount">{{ amount }}</md-option>
|
||||
</md-select>
|
||||
|
||||
|
|
@ -26,7 +26,10 @@
|
|||
type: [Number, String],
|
||||
default: 10
|
||||
},
|
||||
mdPageOptions: [Array, Boolean],
|
||||
mdPageOptions: {
|
||||
type: [Array, Boolean],
|
||||
default: () => [10, 25, 50, 100]
|
||||
},
|
||||
mdPage: {
|
||||
type: [Number, String],
|
||||
default: 1
|
||||
|
|
@ -110,8 +113,11 @@
|
|||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.mdPageOptions = this.mdPageOptions || [10, 25, 50, 100];
|
||||
this.currentSize = this.mdPageOptions.includes(this.currentSize) ? this.currentSize : this.mdPageOptions[0];
|
||||
if (this.mdPageOptions) {
|
||||
this.currentSize = this.mdPageOptions.includes(this.currentSize) ? this.currentSize : this.mdPageOptions[0];
|
||||
} else {
|
||||
this.currentSize = 0;
|
||||
}
|
||||
this.canFireEvents = true;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue