最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue實(shí)現(xiàn)簡單分頁功能

 更新時(shí)間:2022年03月04日 10:11:33   作者:斜影梧桐  
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)簡單分頁功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue實(shí)現(xiàn)簡單的分頁功能的具體代碼,供大家參考,具體內(nèi)容如下

<template>
<div id="pages">
? ? <div class="pages">
? ? ? ? <div class="classInfo" v-for="(item,index) in currentPageData" :key="index">
? ? ? ? ? ? {{item}}
? ? ? ? </div>
? ? ? ? <div class="img1" @click="prevPage()"></div>
? ? ? ? <div class="img2" @click="nextPage()"></div>
? ? </div>
</div>
</template>
<script>
export default {
? ? data () {
? ? ? ? return {
? ? ? ? ? ? totalPage: 1, //所有頁數(shù),默認(rèn)為1
? ? ? ? ? ? currentPage: 1, // 當(dāng)前頁數(shù),默認(rèn)為1
? ? ? ? ? ? pageSize: 9, //每頁顯示條數(shù)
? ? ? ? ? ? classInfo: [11,12,13,14,15,16,17,18,19,1,2,3,4,5,6,5,6,11,7,8,9,5,4,5,4,5], ?//頁面數(shù)據(jù)
? ? ? ? ? ? currentPageData: [] ?// 當(dāng)前頁顯示內(nèi)容
? ? ? ? }
? ? },
? ? mounted(){
? ? ? ? // 計(jì)算一共有幾頁
? ? ? ? this.totalPage = Math.ceil(this.classInfo.length / this.pageSize)
? ? ? ? // 計(jì)算得0時(shí)設(shè)置為1
? ? ? ? this.totalPage = this.totalPage == 0 ? 1:this.totalPage
? ? ? ? this.setCurrentPageData();
? ? },
? ? methods: {
? ? ? ? // 設(shè)置當(dāng)前頁面數(shù)據(jù)
? ? ? ? setCurrentPageData(){
? ? ? ? ? ? let begin = (this.currentPage - 1) * this.pageSize;
? ? ? ? ? ? let end = this.currentPage * this.pageSize;
? ? ? ? ? ? // console.log(begin)
? ? ? ? ? ? // console.log(end)
? ? ? ? ? ? this.currentPageData = this.classInfo.slice(
? ? ? ? ? ? ? ? begin,
? ? ? ? ? ? ? ? end
? ? ? ? ? ? )
? ? ? ? ? ? // console.log(this.currentPageData)
? ? ? ? },
? ? ? ? // 上一頁
? ? ? ? prevPage(){
? ? ? ? ? ? // console.log(this.currentPage)
? ? ? ? ? ? if(this.curentPage == 1) return
? ? ? ? ? ? this.currentPage--;
? ? ? ? ? ? this.setCurrentPageData();
? ? ? ? },
? ? ? ? // 下一頁
? ? ? ? nextPage(){
? ? ? ? ? ? // console.log(this.currentPage)
? ? ? ? ? ? if(this.curentPage == this.totalPage) return

? ? ? ? ? ? this.currentPage++
? ? ? ? ? ? this.setCurrentPageData()
? ? ? ? }
? ? }
}
</script>
<style lang="less" scoped>
#pages{
? ? // background-color: #fff;
? ? .pages{
? ? ? ? margin: 0 auto;
? ? ? ? width: 600px;
? ? ? ? height: 600px;
? ? ? ? // background-color: rgb(64, 180, 80);
? ? ? ? z-index: 999;
? ? ? ? .classInfo{
? ? ? ? ? ? font-size: 25px;
? ? ? ? ? ? color: aliceblue;
? ? ? ? ? ? z-index: 999;
? ? ? ? }
? ? ? ? .img1{
? ? ? ? ? ? width: 150px;
? ? ? ? ? ? height: 50px;
? ? ? ? ? ? background-color: rgb(189, 111, 111);
? ? ? ? }
? ? ? ? .img2{
? ? ? ? ? ? width: 150px;
? ? ? ? ? ? height: 50px;
? ? ? ? ? ? background-color: rgb(41, 94, 110);
? ? ? ? }
? ? }
}
</style>

效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • VUE渲染后端返回含有script標(biāo)簽的html字符串示例

    VUE渲染后端返回含有script標(biāo)簽的html字符串示例

    今天小編就為大家分享 一篇VUE渲染后端返回含有script標(biāo)簽的html字符串示例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-10-10
  • 使用element ui中el-table-column進(jìn)行自定義校驗(yàn)

    使用element ui中el-table-column進(jìn)行自定義校驗(yàn)

    這篇文章主要介紹了使用element ui中el-table-column進(jìn)行自定義校驗(yàn)方式,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • vue3組件通信的方式總結(jié)及實(shí)例用法

    vue3組件通信的方式總結(jié)及實(shí)例用法

    在本篇文章里小編給大家整理的是一篇關(guān)于vue3組件通信的方式總結(jié)及實(shí)例用法,對此有興趣的朋友們可以跟著學(xué)習(xí)下。
    2021-12-12
  • vue中使用 pako.js 解密 gzip加密字符串的方法

    vue中使用 pako.js 解密 gzip加密字符串的方法

    這篇文章主要介紹了vue項(xiàng)目中 使用 pako.js 解密 gzip加密字符串 的方法,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-06-06
  • vue寫一個(gè)組件

    vue寫一個(gè)組件

    這篇文章主要介紹了vue組寫一個(gè)組件,需要的朋友可以參考下
    2018-04-04
  • Vue3?在<script?setup>里設(shè)置組件name屬性的方法

    Vue3?在<script?setup>里設(shè)置組件name屬性的方法

    這篇文章主要介紹了Vue3?在<script?setup>里設(shè)置組件name屬性的方法,本文通過示例代碼給大家介紹的非常詳細(xì),需要的朋友參考下吧
    2023-11-11
  • vue導(dǎo)出excel的兩種實(shí)現(xiàn)方式代碼

    vue導(dǎo)出excel的兩種實(shí)現(xiàn)方式代碼

    這篇文章主要給大家介紹了關(guān)于vue導(dǎo)出excel的兩種實(shí)現(xiàn)方式,在項(xiàng)目中我們可能會(huì)碰到導(dǎo)出Excel文件的需求,文中給出了詳細(xì)的代碼示例,需要的朋友可以參考下
    2023-08-08
  • vuex新手進(jìn)階篇之取值

    vuex新手進(jìn)階篇之取值

    Vuex 是一個(gè)專為 Vue.js 應(yīng)用程序開發(fā)的狀態(tài)管理模式,下面這篇文章主要給大家介紹了關(guān)于vuex新手進(jìn)階篇之取值的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-10-10
  • vue中實(shí)現(xiàn)回車鍵登錄功能

    vue中實(shí)現(xiàn)回車鍵登錄功能

    這篇文章主要介紹了vue中實(shí)現(xiàn)回車鍵登錄功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-02-02
  • vue中實(shí)現(xiàn)拖拽排序功能的詳細(xì)教程

    vue中實(shí)現(xiàn)拖拽排序功能的詳細(xì)教程

    在業(yè)務(wù)中列表拖拽排序是比較常見的需求,下面這篇文章主要給大家介紹了關(guān)于vue中實(shí)現(xiàn)拖拽排序功能的詳細(xì)教程,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-08-08

最新評論

樟树市| 大安市| 莱阳市| 扎鲁特旗| 桂平市| 鹿泉市| 宜君县| 昭苏县| 嘉峪关市| 彝良县| 新田县| 呼和浩特市| 东海县| 平武县| 白朗县| 汝城县| 临泽县| 陆河县| 大同市| 绥棱县| 南雄市| 文安县| 手游| 南安市| 波密县| 祁连县| 渭源县| 泊头市| 青铜峡市| 句容市| 南城县| 抚宁县| 宿迁市| 拉孜县| 保山市| 正宁县| 福安市| 铜陵市| 墨竹工卡县| 屏山县| 唐海县|