Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/vsPagination/vsPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ export default {
current() {
this.getPages()
this.$emit('input', this.current)
},
total() {
this.getPages()
}
},

Expand Down Expand Up @@ -137,7 +140,6 @@ export default {
let pages = this.setPages(1, this.total)
this.pages = pages
}
// console.log('this.total', this.total)
const even = this.max % 2 === 0 ? 1 : 0
if(this.total < 6) {
this.prevRange = Math.floor(this.max / (this.max/2))
Expand Down
26 changes: 12 additions & 14 deletions src/components/vsTable/vsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,15 @@ export default {
},
watch:{
currentx() {
let max = Math.ceil(this.currentx * this.maxItems)
let min = max - this.maxItems

this.datax = this.getItems(min, max)
this.loadData()
},
maxItems() {
this.loadData()
},
data() {
let max = Math.ceil(this.currentx * this.maxItems)
let min = max - this.maxItems

let datax = this.pagination ? this.getItems(min, max) : this.data

this.datax = datax || []
this.loadData()
this.$nextTick(() => {
if(datax.length > 0) {
if(this.datax.length > 0) {
this.changeTdsWidth()
}
})
Expand All @@ -182,10 +177,8 @@ export default {
mounted () {
window.addEventListener('resize', this.listenerChangeWidth)

let max = Math.ceil(this.currentx * this.maxItems)
let min = max - this.maxItems
this.loadData()

this.datax = this.pagination ? this.getItems(min, max) : this.data || []
this.$nextTick(() => {
if(this.datax.length > 0) {
this.changeTdsWidth()
Expand All @@ -196,6 +189,11 @@ export default {
window.removeEventListener('resize', this.listenerChangeWidth)
},
methods:{
loadData() {
let max = Math.ceil(this.currentx * this.maxItems)
let min = max - this.maxItems
this.datax = this.pagination ? this.getItems(min, max) : this.data || []
},
getItems(min, max) {
let items = []

Expand Down