Skip to content

Commit 567440a

Browse files
committed
avoiding mutating prop mdPageOptions (fix vuematerial#830)
1 parent 50e4bbf commit 567440a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/mdTable/mdTablePagination.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="md-table-pagination">
33
<span class="md-table-pagination-label">{{ mdLabel }}:</span>
44

5-
<md-select v-model="currentSize" md-menu-class="md-pagination-select" @change="changeSize" v-if="mdPageOptions">
5+
<md-select v-model="currentSize" md-menu-class="md-pagination-select" @change="changeSize" v-if="mdPageOptions !== false">
66
<md-option v-for="amount in mdPageOptions" :key="amount" :value="amount">{{ amount }}</md-option>
77
</md-select>
88

@@ -26,7 +26,10 @@
2626
type: [Number, String],
2727
default: 10
2828
},
29-
mdPageOptions: [Array, Boolean],
29+
mdPageOptions: {
30+
type: [Array, Boolean],
31+
default: () => [10, 25, 50, 100]
32+
},
3033
mdPage: {
3134
type: [Number, String],
3235
default: 1
@@ -110,8 +113,11 @@
110113
},
111114
mounted() {
112115
this.$nextTick(() => {
113-
this.mdPageOptions = this.mdPageOptions || [10, 25, 50, 100];
114-
this.currentSize = this.mdPageOptions.includes(this.currentSize) ? this.currentSize : this.mdPageOptions[0];
116+
if (this.mdPageOptions) {
117+
this.currentSize = this.mdPageOptions.includes(this.currentSize) ? this.currentSize : this.mdPageOptions[0];
118+
} else {
119+
this.currentSize = 0;
120+
}
115121
this.canFireEvents = true;
116122
});
117123
}

0 commit comments

Comments
 (0)