<h1 v-if="currentPage === 1">1</h1>
<h1 v-if="currentPage === 2">2</h1>
<h1 v-if="currentPage === 3">3</h1>
<el-pagination background layout="prev, pager, next" :total="30" @current-change="handlePageChange" style="justify-content: center;"/>
<script>
export default {
data() {
return {
currentPage: 1
};
},
methods: {
handlePageChange(page) {
this.currentPage = page;
}
}
};
</script>
页面如下
点击1
点击2
点击3