0

I'm pretty new to VueJS but everything was fine and made sense but suddenly, I'm having an issue using vue-plain-pagination. In the data() of my Vue component, I set a currentPage prop default to 1 like so:

  ...
  data() {
    return {
      info: {},
      search: "",
      currentPage: 1,
    };
  }
  ...

In my index.html I set that as the v-model. That v-model, no matter if I change the variable name or place a new variable there, is defaulting to 0.

I've tried to change the variable name, in case it is conflicted with something else, and I've tried initiating and using a different variable. But it always defaults to 0.

// In the index.html....
<v-pagination
  v-model="currentPage"
  :page-count="page_count"
></v-pagination>

// In the js file
var my_vue = new Vue({
  el: '#app',
  delimiters: ['[[', ']]'],
  components: {
    VoerroTagsInput
  },
  data() {
    return {
      info: {},
      search: "",
      currentPage: 1,
    };
  }
})

When I render my page, this value is set to 0, when it should be set to 1. Has anyone seen this issue before, or am I missing something?

yqlim
  • 6,898
  • 3
  • 19
  • 43
  • It looks like your closing tag doesn't match the opening tag. Assuming that's a typo, but may also be causing problems. – ebbishop Jan 24 '19 at 18:24
  • Thanks but yeah that was a typo. I don't know if I should actually ask here https://www.npmjs.com/package/vue-plain-pagination For now, I've just set the variable in a function I call before mounting. I just thought it was strange and wondered if anyone had the same issue – Angel D. Jan 24 '19 at 19:06
  • Try changing `:page-count` to `:length`. In my fiddle here, I'm not seeing that problem: https://jsfiddle.net/ebbishop/bmwyrd1L/ (I've left out components, since I assume that's something custom you've built). Seems to work as expected. With the property `:page-count`, however, it breaks. – ebbishop Jan 24 '19 at 21:44
  • Thanks. It says the page count property is required so that change didn't work for me. What's strange to me is that the currentPage variable is being set to 0, instead of being undefined so I'm trying to find where that change happens – Angel D. Jan 25 '19 at 18:14

0 Answers0