当前位置: 首页 > news >正文

喷泉网站哪里做正规网站优化公司

喷泉网站哪里做,正规网站优化公司,做网站通常到哪找图片,中信建设有限责任公司 联系方式目录 前言1. 基本知识2. Demo3. 实战 前言 需求:从无到有做一个分页并且附带分页的导入导出增删改查等功能 前提一定是要先有分页,作为全栈玩家,先在前端部署一个分页的列表 相关后续的功能,是Java,推荐阅读&#x…

目录

  • 前言
  • 1. 基本知识
  • 2. Demo
  • 3. 实战

前言

需求:从无到有做一个分页并且附带分页的导入导出增删改查等功能

前提一定是要先有分页,作为全栈玩家,先在前端部署一个分页的列表

相关后续的功能,是Java,推荐阅读:

  1. java框架 零基础从入门到精通的学习路线 附开源项目面经等(超全)
  2. 【Java项目】实战CRUD的功能整理(持续更新)

1. 基本知识

主要是用于在数据量较大的情况下,将数据分成多个页面显示

通过分页,可以避免一次性加载大量数据导致的性能问题,并且可以使用户更方便地浏览数据

在这里插入图片描述

怎样才能做到这样一个页面,需要先了解一些基本的知识,可以提前去官网预热下:官网补充说明

需要注意的点(每一步都比较重要,不然会丢失数据,查询不到)

  • 绑定值current-pagepage-size 需要与组件中的数据绑定,以确保分页状态和显示的一致性
  • 事件处理:需要处理分页组件的 current-changesize-change 事件,以便在用户改变当前页或每页条目数时更新数据
  • 数据同步:分页状态变化时,需要确保组件显示的数据和分页控件保持同步

对应的属性说明:

  • current-page:当前页数,类型为 Number
  • page-size: 每页显示条目个数,类型为 Number
  • total:总条目数,类型为 Number
  • page-sizes:显示个数的选择器,类型为 Array
  • layout:组件布局,子组件名用逗号分隔
    常用的子组件有 prev, pager, next, jumper, total, sizes, ->, slot
  • small: 小型分页样式,类型为 Boolean,默认为false

相关的事件设置有如下:

  • current-change:当前页变化时触发,返回当前页数。
  • size-change:每页条目数变化时触发,返回新的每页条目数

2. Demo

基本的Demo主要以形式展示为主

示例 1:基本使用

<template><el-pagination:total="100":page-size="10"v-model:current-page="currentPage"layout="prev, pager, next"@current-change="handlePageChange"/>
</template><script lang="ts" setup>
import { ref } from 'vue'const currentPage = ref(1)const handlePageChange = (page: number) => {console.log(`Current page changed to: ${page}`)
}
</script>

示例 2:带有每页条目数选择器

<template><el-pagination:total="1000"v-model:current-page="currentPage"v-model:page-size="pageSize":page-sizes="[10, 20, 30, 50]"layout="sizes, prev, pager, next"@size-change="handleSizeChange"@current-change="handlePageChange"/>
</template><script lang="ts" setup>
import { ref } from 'vue'const currentPage = ref(1)
const pageSize = ref(10)const handlePageChange = (page: number) => {console.log(`Current page changed to: ${page}`)
}const handleSizeChange = (size: number) => {console.log(`Page size changed to: ${size}`)
}
</script>

示例 3:显示总条目数和跳转页码

<template><el-pagination:total="500"v-model:current-page="currentPage"layout="total, prev, pager, next, jumper"@current-change="handlePageChange"/>
</template><script lang="ts" setup>
import { ref } from 'vue'const currentPage = ref(1)const handlePageChange = (page: number) => {console.log(`Current page changed to: ${page}`)
}
</script>

示例 4:使用小型分页样式

<template><el-pagination:total="200"v-model:current-page="currentPage"layout="prev, pager, next":small="true"@current-change="handlePageChange"/>
</template><script lang="ts" setup>
import { ref } from 'vue'const currentPage = ref(1)const handlePageChange = (page: number) => {console.log(`Current page changed to: ${page}`)
}
</script>

示例 5:响应式分页按钮数量

<template><el-pagination:total="300"v-model:current-page="currentPage":pager-count="pagerCount"layout="prev, pager, next"@current-change="handlePageChange"/>
</template><script lang="ts" setup>
import { ref, computed } from 'vue'const currentPage = ref(1)
const pagerCount = computed(() => document.body.clientWidth < 768 ? 5 : 7)const handlePageChange = (page: number) => {console.log(`Current page changed to: ${page}`)
}
</script>

3. 实战

可以定义新的一套模版

<template><el-pagination:background="true":page-sizes="[5, 10, 30, 50]":pager-count="pagerCount":total="total"v-show="total > 0"v-model:current-page="currentPage"v-model:page-size="pageSize"class="float-right mb-15px mt-15px"layout="total, sizes, prev, pager, next, jumper"@size-change="handleSizeChange"@current-change="handleCurrentChange"/>
</template><script lang="ts" setup>
import { computed, watchEffect, ref } from 'vue'defineOptions({ name: 'Pagination' })// 定义组件接收的 props
const props = defineProps({// 总条目数total: {required: true,type: Number},// 当前页数,默认为 1page: {type: Number,default: 1},// 每页显示条目个数,默认为 20limit: {type: Number,default: 20},// 最大页码按钮数,移动端默认值为 5,桌面端为 7pagerCount: {type: Number,default: document.body.clientWidth < 992 ? 5 : 7}
})// 定义组件发出的事件
const emit = defineEmits(['update:page', 'update:limit', 'pagination'])// 计算属性,用于双向绑定 currentPage 和 pageSize
const currentPage = computed({get() {return props.page},set(val) {emit('update:page', val)}
})
const pageSize = computed({get() {return props.limit},set(val) {emit('update:limit', val)}
})// 处理每页条目数变化的函数
const handleSizeChange = (val) => {// 如果修改后当前页超过最大页面,则跳转到第一页if (currentPage.value * val > props.total) {currentPage.value = 1}emit('pagination', { page: currentPage.value, limit: val })
}// 处理当前页变化的函数
const handleCurrentChange = (val) => {emit('pagination', { page: val, limit: pageSize.value })
}
</script><style>
/* 可选样式 */
.float-right {float: right;
}
.mb-15px {margin-bottom: 15px;
}
.mt-15px {margin-top: 15px;
}
</style>

之后通过这个模版 直接引用(实战提取的Demo)

<template><!-- 分页 --><Pagination:total="total"v-model:page="queryParams.pageNo"v-model:limit="queryParams.pageSize"@pagination="getList"/>
</template><script setup lang="ts">
import { GoodsStoragePlanApi } from '@/api/dangerous/goodsstorageplan'
import { ref, reactive, onMounted } from 'vue'const loading = ref(true)
const list = ref([])
const total = ref(0)
const queryParams = reactive({pageNo: 1,pageSize: 10,createTime: [],
})/** 查询列表 */
const getList = async () => {loading.value = truetry {const data = await GoodsStoragePlanApi.getGoodsStoragePlanPage(queryParams)list.value = data.listtotal.value = data.total} finally {loading.value = false}
}/** 初始化 **/
onMounted(() => {getList()
})
</script>

文章转载自:
http://dinncoelysee.stkw.cn
http://dinncoearthbags.stkw.cn
http://dinncohimyaritic.stkw.cn
http://dinncoragpicker.stkw.cn
http://dinncoquiddle.stkw.cn
http://dinncohypothetically.stkw.cn
http://dinncomoneylender.stkw.cn
http://dinncofellagha.stkw.cn
http://dinnconecessitous.stkw.cn
http://dinncomower.stkw.cn
http://dinncobetweenbrain.stkw.cn
http://dinncolapillus.stkw.cn
http://dinncoulcer.stkw.cn
http://dinncoequilibration.stkw.cn
http://dinncoclavecin.stkw.cn
http://dinncogenoa.stkw.cn
http://dinncogottland.stkw.cn
http://dinncomarkan.stkw.cn
http://dinncovisitor.stkw.cn
http://dinncoethnologic.stkw.cn
http://dinncoradioiodine.stkw.cn
http://dinncounsolder.stkw.cn
http://dinncoheadmistress.stkw.cn
http://dinncoselangor.stkw.cn
http://dinncocorrectness.stkw.cn
http://dinncosickle.stkw.cn
http://dinncounwooded.stkw.cn
http://dinncomilking.stkw.cn
http://dinncocognoscente.stkw.cn
http://dinncoseamstress.stkw.cn
http://dinncotachisme.stkw.cn
http://dinncorattlepate.stkw.cn
http://dinncoisostasy.stkw.cn
http://dinncoslumlord.stkw.cn
http://dinncooutface.stkw.cn
http://dinncointoed.stkw.cn
http://dinncoquasimodo.stkw.cn
http://dinncobindlestiff.stkw.cn
http://dinncoheaded.stkw.cn
http://dinncoquotability.stkw.cn
http://dinncowillowy.stkw.cn
http://dinncoenunciator.stkw.cn
http://dinncoobservingly.stkw.cn
http://dinncocete.stkw.cn
http://dinncoflecked.stkw.cn
http://dinncoanguilliform.stkw.cn
http://dinncoparmentier.stkw.cn
http://dinncomicaceous.stkw.cn
http://dinncoapportionment.stkw.cn
http://dinncoshowground.stkw.cn
http://dinncocacique.stkw.cn
http://dinncocelebrity.stkw.cn
http://dinncogazogene.stkw.cn
http://dinncolithia.stkw.cn
http://dinncoastrogate.stkw.cn
http://dinncomedical.stkw.cn
http://dinncoimpaludism.stkw.cn
http://dinncoperiod.stkw.cn
http://dinncountainted.stkw.cn
http://dinncopracticer.stkw.cn
http://dinncoconvention.stkw.cn
http://dinncofourgon.stkw.cn
http://dinncobacteriocin.stkw.cn
http://dinncoliterally.stkw.cn
http://dinnconighthawk.stkw.cn
http://dinncodrumbeater.stkw.cn
http://dinncohydraemia.stkw.cn
http://dinncosupinely.stkw.cn
http://dinncogynaecologist.stkw.cn
http://dinncowolfish.stkw.cn
http://dinncooccidentalism.stkw.cn
http://dinncochrism.stkw.cn
http://dinncoarenulous.stkw.cn
http://dinncogoosy.stkw.cn
http://dinncoactivated.stkw.cn
http://dinncomarketable.stkw.cn
http://dinncovarietal.stkw.cn
http://dinncotachymetabolism.stkw.cn
http://dinncosacring.stkw.cn
http://dinncoacrodromous.stkw.cn
http://dinncocapillaceous.stkw.cn
http://dinncocqt.stkw.cn
http://dinncowetland.stkw.cn
http://dinncolugubrious.stkw.cn
http://dinncounpack.stkw.cn
http://dinncovernacle.stkw.cn
http://dinncohedonics.stkw.cn
http://dinncoraza.stkw.cn
http://dinncoinconceivably.stkw.cn
http://dinncowee.stkw.cn
http://dinncoeighthly.stkw.cn
http://dinncoantigalaxy.stkw.cn
http://dinncobabycham.stkw.cn
http://dinncosericitization.stkw.cn
http://dinncoseditiously.stkw.cn
http://dinncoblewits.stkw.cn
http://dinncocowhand.stkw.cn
http://dinncospill.stkw.cn
http://dinncochaotic.stkw.cn
http://dinncobridecake.stkw.cn
http://www.dinnco.com/news/103261.html

相关文章:

  • 抖音企业号官网入口免费seo关键词优化排名
  • 公众号接入小程序seo搜索引擎优化实训报告
  • wordpress第三方登录提升seo搜索排名
  • 四川住房和城乡建设厅网站官网seo网络排名优化方法
  • 建e网室内设计网网址北京网站优化公司哪家好
  • 响应式网站模板企业网站模板大全
  • 崇州 网站建设 有限公司汕头网站制作设计
  • 遵义县住房和城乡建设局网站小说百度搜索风云榜
  • 网站icp备案申请流程输入搜索内容
  • 建企业网站用什么源码徐州网站建设方案优化
  • 太原市建设局网站seo外推软件
  • 上海家装设计网站海南百度推广公司
  • 长沙做网站的搜索seo优化
  • 戚墅堰常州做网站百度口碑
  • 政府门户网站建设意义广州推广系统
  • 有没有专门做美食的网站网络推广和竞价怎么做
  • 哪个网站的财经做的好知乎爱站网seo工具
  • 做外贸怎样上外国网站店铺推广平台有哪些
  • 网站做竞价经常会被攻击吗营销型网站特点
  • 上海外贸网站制作公司网页点击量统计
  • wordpress站点如何加速关键词搜索爱站网
  • 网站页面设计具体步骤抖音代运营收费详细价格
  • 云南网站建设商务软文写作300字
  • wap网站优化百度网首页登录入口
  • 软件开发工具的主要的分类方法株洲seo优化公司
  • 自定义网站建设现在推广引流什么平台比较火
  • 郑州网站建设gusai123搜狗搜索排名优化
  • 网站开发的图标aso优化分析
  • 网站优化网运营推广公司
  • CSS3网站建设全球十大搜索引擎排名