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

wordpress同步到报价号石家庄网络seo推广

wordpress同步到报价号,石家庄网络seo推广,哪个网站做外贸年费比较便宜,程序员做网站给女朋友一、关于 UseElementSize UseElementSize 是一个 Vue 组合式 API 的实用工具,通常用于获取 DOM 元素的尺寸信息,例如宽度、高度等。它通常与 v-slot 一起使用,以便在模板中直接访问这些尺寸信息。 地址:https://vueuse.org/core/u…

一、关于 UseElementSize

UseElementSize 是一个 Vue 组合式 API 的实用工具,通常用于获取 DOM 元素的尺寸信息,例如宽度、高度等。它通常与 v-slot 一起使用,以便在模板中直接访问这些尺寸信息。

地址:https://vueuse.org/core/useElementSize/#useelementsize

安装后使用

npm install @vueuse/core

二、设置表格高度自适应

1.关键代码
<template><div class="content-wrap1 p-12 auto-wrap flex flex-col gap-16 bg-white"><!-- 搜索工具栏 --><div class="flex flex-row items-center gap-12"></div><!-- 表格内容 --><div ref="tableDivRef" class="flex-1"><el-table:data="state.tableData"stripeborder:max-height="Math.floor(height) - 50":header-cell-style="{ textAlign: 'center' }"><el-table-columntype="index":index="formIndex"width="70":label="t('table.index')"align="center" /><el-table-column v-for="col of state.headList" :key="col.key" v-bind="getColProps(col)"></el-table-column><el-table-column :label="$t('common.operate')" width="120" align="center"><template #default="scope"><el-linkclass="mr-10"type="primary":underline="false"@click="handleEdit(scope.row.id)">{{ $t('table.btn.edit') }}</el-link><el-link type="danger" :underline="false" @click="handleDelete(scope.row.id)">{{ $t('table.btn.delete') }}</el-link></template></el-table-column></el-table><!-- 分页 --><div class="flex justify-end mt-16"><el-pagination:currentPage="state.page":page-size="state.size":page-sizes="[15, 20, 30, 40, 50]"layout="total, sizes, prev, pager, next, jumper":total="state.total"@size-change="handleSizeChange"@current-change="handleCurrentChange" /></div></div></div>
</template>
<script setup lang="ts">
const tableDivRef = ref(null);
const { height } = useElementSize(tableDivRef);
</script>
<style lang="scss" scoped>
.content-wrap {position: relative;padding: 12px;height: 100%;width: 100%;background-color: #fff;box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.02);display: grid;grid-template-rows: auto 1fr auto;gap: 16px;
}
</style>
2.解析

1.给表格的父元素设置高度为页面的剩余部分,并绑定ref
2.使用const { height } = useElementSize(tableDivRef);获取表格父元素的具体高度
3.给表格设置最大高度,要减去分页的高度::max-height="Math.floor(height) - 50"

三、无渲染组件版本设置表格高度自适应

1.关键代码:
<template><div class="table-page-wrap auto-wrap"><!-- 搜索工具栏部分内容省略 --><div></div><!-- 表格部分 --><UseElementSize v-slot="{ height }"><el-table:data="state.tableData"stripeborder:max-height="height":header-cell-style="{ textAlign: 'center' }"><el-table-columntype="index":index="formIndex"width="70":label="t('table.index')"align="center" /><el-table-column v-for="col of state.headList" :key="col.key" v-bind="getColProps(col)"></el-table-column><el-table-column :label="$t('common.operate')" width="120" align="center"><template #default="scope"><el-linkclass="mr-10"type="primary":underline="false"@click="handleEdit(scope.row.id)">{{ $t('table.btn.edit') }}</el-link><el-link type="danger" :underline="false" @click="handleDelete(scope.row.id)">{{ $t('table.btn.delete') }}</el-link></template></el-table-column></el-table></UseElementSize><!-- 分页 --><div class="flex justify-end"><el-pagination:currentPage="state.page":page-size="state.size":page-sizes="[15, 20, 30, 40, 50]"layout="total, sizes, prev, pager, next, jumper":total="state.total"@size-change="handleSizeChange"@current-change="handleCurrentChange" /></div></div>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.table-page-wrap {position: relative;padding: 12px;height: 100%;width: 100%;background-color: #fff;box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.02);display: grid;// https://stackoverflow.com/a/52380579/7652034grid-template-rows: auto 1fr auto;gap: 16px;
}
</style>
2.解析

模板部分:
< UseElementSize v-slot="{ height }">: 使用 v-slot 插槽来接收 UseElementSize 提供的尺寸信息。这里我们只关心 height,也可以获取其他属性如 width。
:max-height="height": 将列表的最大高度设置为 height

3.遇到的问题
问题1: 表格内容超出时整个页面会显示滚动条

https://github.com/w3c/csswg-drafts/issues/1777
原因是表格父级容器高度计算不正确,1fr 实际上是 minmax(auto, 1fr)的缩写, auto可能会导致内容大于1fr的情况
解决方法:
修改table-page-wrap 样式
grid-template-rows: auto minmax(0, 1fr) auto;

问题2:表格高度显示小数导致无法正常滚动

解决方法
修改表格最大高度设置: :max-height="Math.floor(height || 0)"

http://www.ds6.com.cn/news/53696.html

相关文章:

  • 改版网站会影响百度百度知道合伙人官网登录入口
  • 网站怎么添加滤镜功能吗中国女排联赛排名
  • 旅游网站开发意义谷歌浏览器下载手机版安卓官网
  • 网站开发前景怎么接广告推广
  • 铜陵58同城做网站关键词歌词
  • 手机上如何做微电影网站站长统计app下载
  • 如何比较网站你就知道
  • 建网络商城网站吗淘宝关键词搜索排行榜
  • 哈尔滨网站制作方案南宁seo做法哪家好
  • 光伏项目建设背景windows优化大师怎么使用
  • 几十万做网站平台快手seo软件下载
  • 四川中成煤炭建设集团网站google play应用商店
  • 南宁seo网站建设费用seo站长网怎么下载
  • 赣州建站服务培训机构seo
  • 别人做的网站域名到期怎么办网站优化排名
  • 郴州网站建设专业定制seo去哪里培训
  • 家具外贸网站四川seo多少钱
  • 有比wordpress更好的吗北京seo服务销售
  • 电商类网站有哪些运营培训班有用吗
  • 网站内容不显示app拉新渠道商
  • 做买衣服的网站软文范例100例
  • 官网app软件免费下载整站seo优化
  • codeorg免费编程网站最近的电脑培训班在哪里
  • 小说网站虚拟主机浙江百度推广开户
  • 免费个人简历模板word版宁波网站优化公司推荐
  • 黑龙江建设网网站北京百度快速优化排名
  • 乌兰浩特网站制作怎么自己做网页
  • 学校网站设计的目的福州seo外包公司
  • 新西兰注册公司做网站企业培训权威机构
  • 飞翔时代 网站建设合肥seo整站优化