DWQA QuestionsCategory: ProgramThe on change event of iView paging component cannot be triggered
Changwei asked 1 month ago

The changepage() function is executed console.log
however

<Page :total="page.total" :page-size="page.pageSize" :current="page.page" show-total show-elevator show-sizer @on-change="changePage()"></Page>

If the code is written in this way, it will be reported

TypeError: _vm.changePage is not a function
    at on-change (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-a4e6edc6","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/index/TaskList.vue (0.3529ec41d52ff9a2feda.hot-update.js:14), <anonymous>:39:21)
    at VueComponent.invoker (vue.esm.js:2003)
    at VueComponent.Vue.$emit (vue.esm.js:2514)
    at VueComponent.changePage (iview.js:14756)
    at VueComponent.boundFn [as changePage] (vue.esm.js:191)
    at VueComponent.next (iview.js:14771)
    at boundFn (vue.esm.js:191)
    at invoker (vue.esm.js:2003)
    at HTMLLIElement.fn._withTask.fn._withTask (vue.esm.js:1801)
    

If you write the code like this

<Page :total="page.total" :page-size="page.pageSize" :current="page.page" show-total show-elevator show-sizer @on-change="changePage"></Page>

Then nothing will be output
So what’s the situation?

toBeTheLight replied 1 month ago

How do you write your changepage

1 Answers
liwuwuzhi answered 1 month ago
<Page :total="page.total" :page-size="page.pageSize" :current="page.page" show-total show-elevator show-sizer @on-change="changePage"></Page>
changePage(val){
    console.log(val)
}

Val is the number of pages changed

Changwei replied 1 month ago

Thank you. It’s settled