vuejs-paginate icon indicating copy to clipboard operation
vuejs-paginate copied to clipboard

Vue.js V3 support

Open bverheec opened this issue 4 years ago • 5 comments

Hello, I recently migrated my app to Vue.js v3 and the component wasn't working anymore. So I pulled the code source and here is what I changed to get it working:

In Paginate.vue:

  • line 11

<li v-for="page in pages" :class="[pageClass, page.selected ? activeClass : '', page.disabled ? disabledClass : '', page.breakView ? breakViewClass: '']"> Added v-bind:key="page.index" <li v-for="page in pages" v-bind:key="page.index" :class="[pageClass, page.selected ? activeClass : '', page.disabled ? disabledClass : '', page.breakView ? breakViewClass: '']">

  • line 29 - 33

<template v-for="page in pages"> <a v-if="page.breakView" :class="[pageLinkClass, breakViewLinkClass, page.disabled ? disabledClass : '']" tabindex="0"><slot name="breakViewContent">{{ breakViewText }}</slot></a> <a v-else-if="page.disabled" :class="[pageLinkClass, page.selected ? activeClass : '', disabledClass]" tabindex="0">{{ page.content }}</a> <a v-else @click="handlePageSelected(page.index + 1)" @keyup.enter="handlePageSelected(page.index + 1)" :class="[pageLinkClass, page.selected ? activeClass : '']" tabindex="0">{{ page.content }}</a> </template> Added v-bind:key="page.index" <template v-for="page in pages"> <a v-if="page.breakView" :key="page.index" :class="[pageLinkClass, breakViewLinkClass, page.disabled ? disabledClass : '']" tabindex="0"><slot name="breakViewContent">{{ breakViewText }}</slot></a> <a v-else-if="page.disabled" :key="page.index" :class="[pageLinkClass, page.selected ? activeClass : '', disabledClass]" tabindex="0">{{ page.content }}</a> <a v-else :key="page.index" @click="handlePageSelected(page.index + 1)" @keyup.enter="handlePageSelected(page.index + 1)" :class="[pageLinkClass, page.selected ? activeClass : '']" tabindex="0">{{ page.content }}</a> </template>

Then I updated the binding following this page https://v3.vuejs.org/guide/migration/v-model.html#migration-strategy

  • line 42

value: { became modelValue: {

  • And line 229

this.$emit('input', selected) became this.$emit('update:modelValue', selected)

In case someone else wants to migrate its application and wants to keep the same component.

bverheec avatar Jan 26 '21 20:01 bverheec

@bverheec Create a PR for your fix :)

ZtheLeader avatar Jun 09 '21 23:06 ZtheLeader

Still no V3 support?

axel-verse avatar Oct 15 '21 08:10 axel-verse

Any update on this?

secit-pl avatar Oct 26 '21 11:10 secit-pl

This is by far one of the best Vue js paginate plugins, please can you look at getting Vue 3 support!

stevendprinsloo avatar Jan 18 '23 11:01 stevendprinsloo

Hi there, I made a fork of the repository and updated it under Vue 3. I hope it helps in your applications. @svifty7/vue-paginate

svifty7 avatar Jan 27 '23 07:01 svifty7