本文实例为大家分享了vue实现分页组件的具体代码,供大家参考,具体内容如下
<template> <div class="pageBox"> <ul> <li v-if="this.condition.pageNo > 1 && this.pages.length > 4" class="sides"><a @click="prePage()"><s class="font_main"></s></a></li> <li v-for="(item, index) in pages" :class="{'curtPage': condition.pageNo == item}"> <a v-if="item" @click="goPage(item)" > <s>{{item}}</s> </a> <a href="javascript:;" rel="external nofollow" v-else>...</a> </li> <li class="sides" v-if="condition.pageNo < pageCount && this.pageCount > 4"><a @click="nextPage()"><s class="font_main"></s></a></li> </ul> </div> </template>
js中代码 page 和condition是由父组件中传过来的参数