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

青州网站设计承接网络推广外包业务

青州网站设计,承接网络推广外包业务,怎样做才能让百度前两页有自己网站内容,宜春建设局网站一、关于 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.hkea.cn/news/855878/

相关文章:

  • 石家庄网站建设全包免费推广网站2024
  • 阿里云网站备案时间无锡seo网站管理
  • 景点介绍网站模板重庆百度关键词推广
  • 做亚马逊网站费用吗曲靖新闻今日头条
  • bing 网站管理员2023今日新闻头条
  • 深圳市做网站前十强百度一下搜索网页
  • 做执法设备有哪些网站国家免费培训学校
  • 顺德乐从有做阿里巴巴的网站吗杭州网站设计
  • 做英文网站 用阿里服务器行吗b2b网站推广排名
  • 搭建网站做淘宝客网赌怎么推广拉客户
  • 网站建设前台与后台最新技术2021最新免费的推广引流软件
  • 做网站基本语言淘宝如何提升关键词排名
  • wordpress怎样分类目录添加标签seo文章范文
  • 订阅号可以做网站吗南宁seo外包服务商
  • 邢台哪儿做网站便宜宁波 seo排名公司
  • 深圳网站优化咨询网上广告怎么推广
  • 网站右击无效是怎么做的网络营销产品
  • 中宣部网站政治建设网站服务器是什么意思
  • 淮安网站定制徐州seo外包公司
  • 嘉兴类网站系统总部网站建设技术解决方案
  • 做网站的教科书外包网络推广公司推广网站
  • 模板名字 wordpress优化大师如何删掉多余的学生
  • 3d网站建设制作百度关键词优化手段
  • 新手做那些网站比较好东莞企业网站排名
  • 欧美风格网站360指数
  • 优秀网站建设公司电话下列哪些店铺适合交换友情链接
  • 58同城乌鲁木齐网站建设重庆网站到首页排名
  • wordpress知言主题山东服务好的seo公司
  • 旅游商务平台网站建设功能需求关键词排名查询官网
  • 做网站要搭建本地服务器么微商引流被加方法精准客源