(共556篇)
全部分类

支持垂直固定header滚动的table案例
[ CSS基础 ] 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<template>
  <div class="v_table">
    <div
      class="v_table_left"
      :style="{ height: `calc(100% - ${scrollHeight}px)` }"
    >
      <div class="left_container"></div>
    </div>
    <div
      class="v_table_right"
      :style="{ height: `calc(100% - ${scrollHeight}px)` }"
    >
      <div class="left_container"></div>
    </div>
    <div class="v_table_container" ref="container">
      <var-scene flex middle fill class="v_table_wrapper">
        <div>1</div>
        <div>1</div>
        <div>1</div>
        <div>1</div>
        <div>1</div>
      </var-scene>
    </div>
  </div>
</template>
<script>
export default {
  name: "VarTable",
  data() {
    return {
      scrollHeight: 0,
    };
  },
  mounted() {
    console.log(
      this.$refs.container.offsetHeight,
      this.$refs.container.clientHeight
    );
    this.scrollHeight =
      this.$refs.container.offsetHeight - this.$refs.container.clientHeight;
  },
};
</script>
<style lang="scss" scoped>
.v_table {
  position: relative;
  width: 900px;
  height: 300px;
  background-color: rgb(228, 228, 228);
  overflow: hidden;
  .v_table_left {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: 200px;
    height: calc(100% - 16px);
    background-color: red;
    overflow: auto;
  }

  .v_table_right {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: calc(100% - 16px);
    z-index: 10;
    background-color: green;
  }
  .left_container {
    height: 500px;
    width: 100px;
    background-color: orange;
  }
  .v_table_container {
    width: 100%;
    height: 100%;
    padding-bottom: 10px;
    overflow: auto;
  }
  .v_table_wrapper {
    width: 1200px;
    height: 500px;
  }
}
</style>