Skip to content

Commit f5c62b4

Browse files
committed
refactor: CPagination: remove responsive functionality
1 parent 583922b commit f5c62b4

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

src/components/Pagination/CPagination.vue

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
</template>
8383

8484
<script>
85-
import elementResizeDetectorMaker from 'element-resize-detector'
8685
import CLink from '../Link/CLink'
8786
8887
export default {
@@ -140,13 +139,6 @@
140139
lastButtonHtml: {
141140
type: String,
142141
default: '&raquo;'
143-
},
144-
responsive: [Boolean, Object]
145-
},
146-
data () {
147-
return {
148-
minifiedSize: null,
149-
erd: elementResizeDetectorMaker()
150142
}
151143
},
152144
watch: {
@@ -159,23 +151,15 @@
159151
}
160152
}
161153
},
162-
mounted () {
163-
if (this.responsive) {
164-
this.erd.listenTo(this.$el, this.onWrapperResize)
165-
}
166-
},
167154
computed: {
168-
dims () {
169-
return this.size === 'sm' ? 'sm' : this.minifiedSize || this.size
170-
},
171155
backArrowsClasses () {
172156
return ['page-item', { 'disabled': this.activePage === 1 }]
173157
},
174158
nextArrowsClasses () {
175159
return ['page-item', { 'disabled': this.activePage === this.pages }]
176160
},
177161
computedClasses () {
178-
return `pagination pagination-${this.dims} justify-content-${this.align}`
162+
return `pagination pagination-${this.size} justify-content-${this.align}`
179163
},
180164
showDots () {
181165
return this.dots && this.limit > 4 && this.limit < this.pages
@@ -215,12 +199,6 @@
215199
}
216200
},
217201
methods: {
218-
onWrapperResize (el) {
219-
const md = this.responsive.md || 600
220-
const sm = this.responsive.sm || 400
221-
const wrapper = el.clientWidth
222-
this.minifiedSize = wrapper > md ? null : wrapper > sm ? 'md' : 'sm'
223-
},
224202
setPage (number) {
225203
if (number !== this.activePage) {
226204
this.$emit('update:activePage', number)

src/components/Pagination/tests/CPagination.spec.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const customWrapper = mount(Component, {
1212
limit: 7,
1313
dots: false,
1414
arrows: false,
15-
doubleArrows: false,
16-
responsive: true
15+
doubleArrows: false
1716
}
1817
})
1918

@@ -39,14 +38,4 @@ describe(ComponentName, () => {
3938
links.at(4).trigger('click')
4039
expect(defaultWrapper.emitted()['update:activePage']).toBeTruthy()
4140
})
42-
it('correctly change size on wrapper resize when responsive', () => {
43-
customWrapper.vm.onWrapperResize({ clientWidth: 700 })
44-
expect(customWrapper.vm.dims).toBe('lg')
45-
46-
customWrapper.vm.onWrapperResize({ clientWidth: 500 })
47-
expect(customWrapper.vm.dims).toBe('md')
48-
49-
customWrapper.vm.onWrapperResize({ clientWidth: 300 })
50-
expect(customWrapper.vm.dims).toBe('sm')
51-
})
5241
})

0 commit comments

Comments
 (0)