File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ export default {
106
106
current () {
107
107
this .getPages ()
108
108
this .$emit (' input' , this .current )
109
+ },
110
+ total () {
111
+ this .getPages ()
109
112
}
110
113
},
111
114
@@ -137,7 +140,6 @@ export default {
137
140
let pages = this .setPages (1 , this .total )
138
141
this .pages = pages
139
142
}
140
- // console.log('this.total', this.total)
141
143
const even = this .max % 2 === 0 ? 1 : 0
142
144
if (this .total < 6 ) {
143
145
this .prevRange = Math .floor (this .max / (this .max / 2 ))
Original file line number Diff line number Diff line change @@ -157,20 +157,15 @@ export default {
157
157
},
158
158
watch: {
159
159
currentx () {
160
- let max = Math . ceil ( this .currentx * this . maxItems )
161
- let min = max - this . maxItems
162
-
163
- this .datax = this . getItems (min, max )
160
+ this .loadData ( )
161
+ },
162
+ maxItems () {
163
+ this .loadData ( )
164
164
},
165
165
data () {
166
- let max = Math .ceil (this .currentx * this .maxItems )
167
- let min = max - this .maxItems
168
-
169
- let datax = this .pagination ? this .getItems (min, max) : this .data
170
-
171
- this .datax = datax || []
166
+ this .loadData ()
172
167
this .$nextTick (() => {
173
- if (datax .length > 0 ) {
168
+ if (this . datax .length > 0 ) {
174
169
this .changeTdsWidth ()
175
170
}
176
171
})
@@ -182,10 +177,8 @@ export default {
182
177
mounted () {
183
178
window .addEventListener (' resize' , this .listenerChangeWidth )
184
179
185
- let max = Math .ceil (this .currentx * this .maxItems )
186
- let min = max - this .maxItems
180
+ this .loadData ()
187
181
188
- this .datax = this .pagination ? this .getItems (min, max) : this .data || []
189
182
this .$nextTick (() => {
190
183
if (this .datax .length > 0 ) {
191
184
this .changeTdsWidth ()
@@ -196,6 +189,11 @@ export default {
196
189
window .removeEventListener (' resize' , this .listenerChangeWidth )
197
190
},
198
191
methods: {
192
+ loadData () {
193
+ let max = Math .ceil (this .currentx * this .maxItems )
194
+ let min = max - this .maxItems
195
+ this .datax = this .pagination ? this .getItems (min, max) : this .data || []
196
+ },
199
197
getItems (min , max ) {
200
198
let items = []
201
199
You can’t perform that action at this time.
0 commit comments