| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <div class="table">
- <div class="table__content">
- <div class="table__content_label">
- <div class="label-t" v-for="(item, index) in columns" :key="`svvhbcth-${index}`">{{ item.name }}</div>
- </div>
- <div class="table__content_list">
- <div class="table__content_list_row" v-for="(item, index) in data" :key="`svvhbct-${index}`">
- <div v-for="(t, i) in columns" :key="`svvhbctr-${i}`">
- <slot :name="t.prop" :scope="item">
- <span>{{ get(item, t.prop) }}</span>
- </slot>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { defineProps } from 'vue';
- import _ from 'lodash-es';
- let props = withDefaults(
- defineProps<{
- /** 列表表头配置,每个prop都有其对应的slot来提供定制化功能 */
- columns: { prop: string; name: string }[];
- data: any[];
- defaultValue: string;
- }>(),
- {
- columns: () => [],
- data: () => [],
- defaultValue: '-',
- }
- );
- function get(o, p) {
- return _.get(o, p, props.defaultValue);
- }
- </script>
- <style lang="less" scoped>
- @font-face {
- font-family: 'douyuFont';
- src: url('@/assets/font/douyuFont.otf');
- }
- .table__content {
- height: 100%;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- align-items: center;
- .table__content_label {
- width: 366px;
- height: 32px;
- display: flex;
- justify-content: space-around;
- align-items: center;
- background: url('@/assets/images/company/content-label.png') no-repeat;
- .label-t {
- color: #3df6ff;
- text-align: center;
- font-size: 14px;
- }
- }
- .table__content_list {
- height: calc(100% - 32px);
- width: 378px;
- display: flex;
- flex-direction: column;
- // justify-content: space-around;
- justify-content: flex-start;
- padding: 5px 0px;
- box-sizing: border-box;
- overflow-y: auto;
- .table__content_list_row {
- width: 100%;
- height: 28px;
- display: flex;
- justify-content: space-around;
- align-items: flex-start;
- background: url('@/assets/images/company/content-text.png') no-repeat;
- color: #fff;
- margin-bottom: 5px;
- span {
- display: inline-block;
- text-align: center;
- }
- }
- }
- }
- </style>
|