电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術文章
文章詳情頁

Ant Design Vue table中列超長顯示...并加提示語的實例

瀏覽:8日期:2022-11-08 09:07:24

我就廢話不多說了,大家還是直接看代碼吧~

<template> <a-row class='a-left'> <a-row> <p class='a-title'>今日考勤狀況</p> <a-row type='flex' justify='space-around'> <a-col :span='4' class='block'> <h3>出勤狀況總覽</h3> {{ cntAll.cnt }}/ <span style='color: #F0FF00'>{{ cntAll.exceptionCount }}</span> </a-col> <a-col :span='4' class='block'> <h3>管理人員出勤狀況</h3> {{ cntLeader.cnt }}/ <span style='color: #F0FF00'>{{ cntLeader.exceptionCount }}</span> </a-col> <a-col :span='4' class='block'> <h3>施工人員出勤狀況</h3> {{ cntSpecial.cnt }}/ <span style='color: #F0FF00'>{{ cntSpecial.exceptionCount }}</span> </a-col> <a-col :span='4' class='block'> <h3>特種設備人員出勤狀況</h3> {{ cntEmployee.cnt }}/ <span style='color: #F0FF00'>{{ cntEmployee.exceptionCount }}</span> </a-col> </a-row> </a-row> <a-row class='a-mt-20'> <h3 class='a-title'>考勤記錄查詢</h3> </a-row> <!--查詢條件--> <a-form :form='form' layout='inline'> <a-form-item label='姓名'> <a-input v-model='queryParam.name' placeholder='請輸入姓名' :disabled='loading' /> </a-form-item> <a-form-item label='日期'> <y-date-picker :start.sync='queryParam.startDate1' :end.sync='queryParam.endDate1' :disabled='loading' /> </a-form-item> <a-form-item> <a-button :disabled='loading' icon='search' @click='searchData'>查詢</a-button> <a-button :disabled='loading' icon='reload' @click='reset'>刷新</a-button> </a-form-item> </a-form> <!--查詢結果--> <a-row class='a-pt-20 a-pt-10'> <a-col :span='6'> <p class='a-title'>查詢結果</p> </a-col> <a-col :span='6' :offset='12' class='a-right'> <a-button :disabled='loading' icon='file-pdf' @click='exportData'>導出</a-button> </a-col> <a-table :row-key='uuid' :columns='columns' :data-source='RenYuanKaoQin.data' :loading='loading' :pagination='{ position: ’bottom’, total: Number(RenYuanKaoQin.total), current: Number(queryParam.pageNumber), pageSize: Number(queryParam.pageSize), showSizeChanger: true, pageSizeOptions: [’7’, ’14’, ’21’], showTotal: total => `總共有${total}條` }' :scroll='{x:1300, y: ’calc(100vh - 600px)’ }' :locale='{ emptyText: ’暫未找到符合條件的結果’ }' @change='tableChange' > <!--操作--> <template slot='action' slot-scope='text, record'> <a href='javascript:;' rel='external nofollow' @click='intoDetail(record)'>詳情</a> </template> <span slot='serial' slot-scope='text, record, index'>{{ index + 1 }}</span> //處理超長生成...,并加上提示文字代碼 <div : slot='groupName' slot-scope='text, record'> <a-tooltip placement='left'> <template slot='title'> <span>{{record.groupName}}</span> </template> {{record.groupName}} </a-tooltip> </div> </a-table> </a-row> </a-row></template>

<script>import { YDatePicker } from ’@/components/Form’import { mapGetters, mapActions } from ’vuex’import { clone, get, now } from ’lodash’export default { name: ’RenYuan-KaoQin’, components: { YDatePicker }, metaInfo: { title: ’考勤記錄’ }, data() { return { loading: false, form: this.$form.createForm(this), initQueryParam: {}, queryParam: { pageNumber: 1, pageSize: 7, name: ’’, startDate1: ’’, endDate1: ’’ }, columns: [ { title: ’序號’, align: ’center’, width: 80, scopedSlots: { customRender: ’serial’ } }, { title: ’姓名’, align: ’center’, width: 150, dataIndex: ’memberName’ }, { title: ’簽到時間’, align: ’center’, width: 250, dataIndex: ’inTimeNew’ }, { title: ’簽退時間’, align: ’center’, width: 250, dataIndex: ’outTimeNew’ }, { title: ’出勤時間’, align: ’center’, width: 150, dataIndex: ’jgHour’ }, { title: ’所屬勞動組織’, align: ’center’, width: 200, scopedSlots: { customRender: ’groupName’ } },//這里groupName指向 div中slot='groupName' { title: ’專業(yè)分工’, align: ’center’, width: 150, dataIndex: ’workTypeNew’ }, { title: ’人員類別’, align: ’center’, dataIndex: ’personnelTypeStr’ } ] } }, computed: { ...mapGetters([’RenYuanKaoQin’]), cntAll() { return { cnt: get(this.RenYuanKaoQin, ’count.cntAll[0].cnt’), exceptionCount: get(this.RenYuanKaoQin, ’count.cntAll[0].exceptionCount’) } }, cntSpecial() { return { cnt: get(this.RenYuanKaoQin, ’count.cntSpecial[0].cnt’), exceptionCount: get(this.RenYuanKaoQin, ’count.cntSpecial[0].exceptionCount’) } }, cntLeader() { return { cnt: get(this.RenYuanKaoQin, ’count.cntLeader[0].cnt’), exceptionCount: get(this.RenYuanKaoQin, ’count.cntLeader[0].exceptionCount’) } }, cntEmployee() { return { cnt: get(this.RenYuanKaoQin, ’count.cntEmployee[0].cnt’), exceptionCount: get(this.RenYuanKaoQin, ’count.cntEmployee[0].exceptionCount’) } } }, beforeRouteUpdate(to, from, next) { next() this.getData() }, beforeRouteEnter(to, from, next) { next(async vm => { vm.initQueryParam = clone(vm.queryParam) // 初始表單 vm.getRenYuanKaoQinCount({ xmbh: vm.$store.state.route.params.xmbh }) vm.getData() }) }, methods: { ...mapActions([’getRenYuanKaoQin’, ’getRenYuanKaoQinCount’]), uuid() { return now() + Math.random() }, /** 清空查詢條件 */ reset() { this.queryParam = clone(this.initQueryParam) this.form.resetFields() this.getData() }, /** 獲取表格數(shù)據(jù) */ async getData() { this.loading = true await this.getRenYuanKaoQin({ xmbh: this.$store.state.route.params.xmbh, ...this.queryParam }) this.loading = false }, /** 表格數(shù)據(jù)變化 */ tableChange(pagination) { this.queryParam.pageSize = pagination.pageSize this.queryParam.pageNumber = pagination.current this.getData() }, searchData() { this.queryParam.pageNumber = 1 this.getData() } }}</script>

<style lang='stylus' scoped>.block { height: 86px; padding: 10px 0; box-sizing: border-box; background: url(’../../../assets/home/bg.png’) no-repeat; background-size: 100% 100%; text-align: center; font-size: 20px; h3 { text-align: center; font-size: 18px; } span { font-size: 20px; }}</style>

補充知識:ant-design table 中的td 數(shù)據(jù)過多顯示部分,鼠標放上去顯示全部

第一:表格中的數(shù)據(jù)自動換行,所以表格中的行高不一致

目標實現(xiàn):防止自動換行,

代碼實現(xiàn)://*** 是主要實現(xiàn)

:global { .ant-table-tbody > tr > td, .ant-table-thead > tr > th { height: 62px; white-space:nowrap;//*** overflow: auto;//*** } .ant-table-thead > tr > th { background: #2db7f5; white-space:nowrap;//*** overflow: auto;//*** }

第二:上述目標實現(xiàn),但是全部顯示出來

目標實現(xiàn):指定td的數(shù)據(jù)顯示部分以及...,當鼠標放上去顯示全部

代碼實現(xiàn):

const webColumns = [ { title: ’IP’, dataIndex: ’srcIp’, key: ’srcIp’, width:’15%’, },{ title: ’描述’, dataIndex: ’msg’, key: ’msg’, //width:’8%’, onCell: ()=>{ return { style:{ maxWidth:260, overflow:’hidden’, whiteSpace:’nowrap’, textOverflow:’ellipsis’, cursor:’pointer’, } } }, render: (text) => <span placement='topLeft' title={text}>{text}</span>, } ]

其中 oncell()以下為主要實現(xiàn)。

以上這篇Ant Design Vue table中列超長顯示...并加提示語的實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Vue
相關文章:
主站蜘蛛池模板: 东莞市超赞电子科技有限公司 全系列直插/贴片铝电解电容,电解电容,电容器 | 飞行者联盟-飞机模拟机_无人机_低空经济_航空技术交流平台 | 江苏密集柜_电动_手动_移动_盛隆柜业江苏档案密集柜厂家 | 剪刃_纵剪机刀片_分条机刀片-南京雷德机械有限公司 | 高温高压釜(氢化反应釜)百科| 陕西华春网络科技股份有限公司 | 加气混凝土砌块设备,轻质砖设备,蒸养砖设备,新型墙体设备-河南省杜甫机械制造有限公司 | YT保温材料_YT无机保温砂浆_外墙保温材料_南阳银通节能建材高新技术开发有限公司 | 媒介云-全网整合营销_成都新闻媒体发稿_软文发布平台 | 青岛空压机,青岛空压机维修/保养,青岛空压机销售/出租公司,青岛空压机厂家电话 | 蜗轮丝杆升降机-螺旋升降机-丝杠升降机厂家-润驰传动 | 浙江栓钉_焊钉_剪力钉厂家批发_杭州八建五金制造有限公司 | 武汉印刷厂-不干胶标签印刷厂-武汉不干胶印刷-武汉标签印刷厂-武汉标签制作 - 善进特种标签印刷厂 | 飞歌臭氧发生器厂家_水处理臭氧发生器_十大臭氧消毒机品牌 | 贴板式电磁阀-不锈钢-气动上展式放料阀-上海弗雷西阀门有限公司 工业机械三维动画制作 环保设备原理三维演示动画 自动化装配产线三维动画制作公司-南京燃动数字 | 海外仓系统|国际货代系统|退货换标系统|WMS仓储系统|海豚云 | 分光色差仪,测色仪,反透射灯箱,爱色丽分光光度仪,美能达色差仪维修_苏州欣美和仪器有限公司 | 合景一建-无尘车间设计施工_食品医药洁净车间工程装修总承包公司 | 破碎机_上海破碎机_破碎机设备_破碎机厂家-上海山卓重工机械有限公司 | 江苏密集柜_电动_手动_移动_盛隆柜业江苏档案密集柜厂家 | 垃圾处理设备_餐厨垃圾处理设备_厨余垃圾处理设备_果蔬垃圾处理设备-深圳市三盛环保科技有限公司 | 高中学习网-高考生信息学习必备平台 | 江西自考网-江西自学考试网 | ALC墙板_ALC轻质隔墙板_隔音防火墙板_轻质隔墙材料-湖北博悦佳 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 郑州外墙清洗_郑州玻璃幕墙清洗_郑州开荒保洁-河南三恒清洗服务有限公司 | 交通信号灯生产厂家_红绿灯厂家_电子警察监控杆_标志杆厂家-沃霖电子科技 | 上海小程序开发-上海小程序制作公司-上海网站建设-公众号开发运营-软件外包公司-咏熠科技 | 东亚液氮罐-液氮生物容器-乐山市东亚机电工贸有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | AR开发公司_AR增强现实_AR工业_AR巡检|上海集英科技 | 网站优化公司_北京网站优化_抖音短视频代运营_抖音关键词seo优化排名-通则达网络 | 深圳办公室装修,办公楼/写字楼装修设计,一级资质 - ADD写艺 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 网站优化公司_SEO优化_北京关键词百度快速排名-智恒博网络 | 垃圾清运公司_环卫保洁公司_市政道路保洁公司-华富环境 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 低噪声电流前置放大器-SR570电流前置放大器-深圳市嘉士达精密仪器有限公司 | 间苯二酚,间苯二酚厂家-淄博双和化工| 欧盟ce检测认证_reach检测报告_第三方检测中心-深圳市威腾检验技术有限公司 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 |