kevin73's avatar

vuejs - Element UI : problem with pagination component

Hi guys , 1

the image show el-pagination , it's a component of Element-ui , my problem i have to click two times on the button number 2 or the next arrow so that the next button turns blue

3

but the value of current_page is 2 . someone could help me ? Thank you in advance

my code :

    <el-pagination background
      @current-change="handleCurrentChange"
      :current-page="current_page"
      layout="prev, pager, next"
      :total="2">
    </el-pagination>
    
    <script>
    export default {
            name: 'EstimateIndex',
            data() {
                return {
                    current_page: 1,
                    isRequestOngoing: false,
                    client_status: null,
                    code_estimate: '',
                }
            },
            watch: {
                current_page: {
                    handler: function () {
                        this.resetSelectedEstimate()
                        this.fetchData()
                    },
           },
           methods: {
                handleCurrentChange(val) {
                    this.current_page = val;
                    console.log(val)
                }
           }
    </script>
0 likes
2 replies
Sti3bas's avatar
Sti3bas
Best Answer
Level 53

@kevin73 works fine to me. The problem might be in resetSelectedEstimate and/or fetchData methods.

kevin73's avatar

when i remove current_page from watch: it works , so i fixed it , thank you

Please or to participate in this conversation.