• table 上下左右 4根线的写法 :before :after 他们就能把td里面右下的那颗线给盖上 还有body和header横向滚动的联动 || 不能把body套在header上是为了上header表头固定 || 还有表头header的右侧overflow-y 是否出现滚动条的位置 记得有一个$nextTick 要不然会获取不到高度 高度就为0了 || 横向滚动条纵向滚动条


    table 上下左右 4根线的写法

    <!--
    * @description 重点查核人员表
    !-->
    <template>
    <div class="keyCheckersTable">
    <div class="tableZenHeader" ref="tableZenHeader">
    <tableZen ref="tableZen"
    disInnerInit
    width="1500"
    :styles="{border:0}"
    :columns="columns"
    @reload="tableZenReloadHandle">
    </tableZen>
    </div>

    <div :style="{height:innerHeight+'px' }" class="tableZenBody" ref="tableZenBody" @scroll="scrollHandle">
    <div style="height: 500px; 1500px;">
    123
    </div>
    </div>
    </div>
    </template>

    <script>
    import columns from './columns'
    import mockJson from './mockJson'
    import buttonZen from '@/components/buttonZen'
    import tableZen from '@/components/tableZen/tableZen' // 表格组件
    import privateZenMixins from '@/view/biz/input/components/privateZenMixins.js'
    export default {
    name: 'keyCheckersTable',
    mixins: [privateZenMixins],
    components: {
    tableZen,
    buttonZen
    },
    props: {
    diffHeight: {
    type: Number,
    default: 315
    }
    },
    data () {
    return {
    innerHeight: 0,
    mockJson,
    columns
    }
    },
    watch: {},
    computed: {},
    methods: {
    hasScrollbar () {
    this.consoleInfo('hasScrollbar', this.$refs.tableZenBody.scrollHeight, this.$refs.tableZenBody.offsetHeight)
    // return this.$refs.tableZenBody.scrollWidth > this.$refs.tableZenBody.offsetWidth
    return this.$refs.tableZenBody.scrollHeight > this.$refs.tableZenBody.offsetHeight
    },
    setScrollbar () {
    this.$nextTick(() => {
    this.setScrollbarExecute()
    })
    },
    setScrollbarExecute () {
    this.consoleInfo('this.hasScrollbar()', this.hasScrollbar())
    if (this.hasScrollbar()) { // 如果有横向滚动条
    this.$refs.tableZenHeader.style['overflow-y'] = 'scroll'
    } else {
    this.$refs.tableZenHeader.style['overflow-y'] = 'hidden'
    }
    },
    scrollHandle () {
    // this.consoleInfo('scrollHandle scrollLeft', this.$refs.tableZenBody.scrollLeft)
    this.$refs.tableZenHeader.scrollLeft = this.$refs.tableZenBody.scrollLeft
    },
    init () {
    this.calcHeight()
    this.setScrollbar()

    window.addEventListener('resize', () => {
    this.consoleInfo('resize')
    this.calcHeight()
    this.setScrollbar()
    })
    },
    calcHeight () {
    this.innerHeight = window.innerHeight - this.diffHeight
    // this.consoleInfo('height', window.innerHeight, this.diffHeight, this.innerHeight)
    },
    tableZenReloadHandle (anyParams, callback) {
    let ret = {
    total: 100,
    data: [{ a1: 'test' }]
    }
    callback(ret)
    }
    },
    created () {},
    mounted () {
    this.init()
    }
    }
    </script>
    <style lang="less">
    .keyCheckersTable {

    border-top: 1px solid #dcdee2;
    border-left: 1px solid #dcdee2;
    position: relative;
    &:before {
    content: '';
    100%;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: #dcdee2;
    z-index: 1;
    }
    &:after {
    content: '';
    1px;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    background-color: #dcdee2;
    z-index: 3;
    }
    .tableZenHeader {
    overflow-x: hidden;
    /*overflow-y: scroll;*/
    }
    .ivu-table-tip { display: none;}
    .tableZenBody {
    overflow: auto;
    }
    .ivu-table { margin-bottom: 0 !important;}
    }
    </style>
  • 相关阅读:
    51nod 1087 1 10 100 1000(找规律+递推+stl)
    51nod 1082 与7无关的数 (打表预处理)
    51 nod 1080 两个数的平方和
    1015 水仙花数(水题)
    51 nod 1003 阶乘后面0的数量
    51nod 1002 数塔取数问题
    51 nod 1001 数组中和等于K的数对
    51 nod 1081 子段求和
    51nod 1134 最长递增子序列 (O(nlogn)算法)
    51nod 1174 区间中最大的数(RMQ)
  • 原文地址:https://www.cnblogs.com/pengchenggang/p/11502233.html
Copyright © 2020-2023  润新知