lokyoung / vuejs-paginate

A Vue.js(v2.x+) component for creating pagination.
MIT License
779 stars 171 forks source link

[Vue warn]: Computed property "selected" was assigned to but it has no setter #95

Closed jbrodriguez closed 5 years ago

jbrodriguez commented 5 years ago

I'm getting this warning coming from this component.

Looking at the code, there's a getter (https://github.com/lokyoung/vuejs-paginate/blob/master/src/components/Paginate.vue#L140), but no setter.

Any thoughts ?

esmaei1 commented 5 years ago

same problem.

andrian0vv commented 5 years ago

Same here.

lokyoung commented 5 years ago

@jbrodriguez @esmaei1 @Andrianov Please try v2.1.0. Thanks. Any questions please reopen this issue, thanks!

rafaelmagalhaes commented 5 years ago

i'm having the same issue i have version 2.1.0 Im trying to show the active page if theres an offset in the url query all works fine but when i try change page i get the above erro

<paginate
          v-model="currentPage"

          :page-count="totalRows"
          :click-handler="nextPage"
          :prev-text="'Prev'"
          :next-text="'Next'"
          :page-link-class="'page-link'"
          :pageClass="'page-item'"
          :prev-class="'page-item'"
          :prev-link-class="'page-link'"
          :next-class="'page-item'"
          :next-link-class="'page-link'"
          :containerClass="'pagination justify-content-center'"
        >
        </paginate>

   async nextPage(pageNum) {
        const query = this.$route.query;
        const newQuery = {
          offset: this.offset = (this.perPage * pageNum) - this.perPage,
          limit: query.limit || 18,
          subcategory: query.subcategory || '',
          category: query.category || '',
          country: query.country || '',
          city: query.city || '',
          state: query.state || '',
          search: query.search || ''
        };
        this.$router.push({query: newQuery});
        await this.$store.dispatch('search/getSearchResults', newQuery)
      }

currentPage() {
        return (this.query.offset / 18) + 1
      },
rafaelmagalhaes commented 5 years ago

i sorted it out by removing currentPage from computed and adding it to data()

data() {
      return {
        perPage: 18,
        offset: 0,
        currentPage: this.$route.query.offset !== 0 ? (this.$route.query.offset / 18) + 1 : 1
      }
    },
tonystaark commented 5 years ago

i sorted it out by removing currentPage from computed and adding it to data()

data() {
      return {
        perPage: 18,
        offset: 0,
        currentPage: this.$route.query.offset !== 0 ? (this.$route.query.offset / 18) + 1 : 1
      }
    },

Dont think this is a good one. Any other better solution?

rafaelmagalhaes commented 5 years ago

i sorted it out by removing currentPage from computed and adding it to data()

data() {
      return {
        perPage: 18,
        offset: 0,
        currentPage: this.$route.query.offset !== 0 ? (this.$route.query.offset / 18) + 1 : 1
      }
    },

Dont think this is a good one. Any other better solution?

I didn't look into it I just left it on the data(), let me know if you find another way

ImDaHeat commented 4 years ago

having same problem, is there anything else to sort this out

artush-alexanyan commented 4 years ago

I have the same issue - Computed property "count" was assigned to but it has no setter. I just created my Vue app and tested the vuex. Started with an issue, it's not a good sign (( does anybody help me?