|
@@ -1,18 +1,31 @@
|
|
|
<script setup lang='ts'>
|
|
|
-import { PropType } from 'vue';
|
|
|
-
|
|
|
+import { PropType,computed } from 'vue';
|
|
|
+import { isMobile } from '@/utils/utils'
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
data: {
|
|
|
type: Array as PropType<any[]>,
|
|
|
required: true
|
|
|
+ },
|
|
|
+ config: {
|
|
|
+ type: Object
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+//手机端pc端又要不同样式
|
|
|
+const dynamicSty = computed(()=>{
|
|
|
+ return isMobile() ? 'mobile-sty' : 'pc-sty';
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
-<div class="table-wrapper">
|
|
|
- <table cellpadding="0" cellspacing="0">
|
|
|
+<div :class="['table-wrapper',dynamicSty ]">
|
|
|
+ <table
|
|
|
+ cellpadding="0"
|
|
|
+ cellspacing="0"
|
|
|
+ :style="`font-size: ${props.config.FontSize||9}px`"
|
|
|
+ >
|
|
|
<tbody>
|
|
|
<tr
|
|
|
v-for="(item,index) in props.data"
|
|
@@ -78,19 +91,18 @@ const props = defineProps({
|
|
|
max-width: calc(100vw - 20px);
|
|
|
margin: 0 auto;
|
|
|
// margin-right: -5px;
|
|
|
- overflow: hidden;
|
|
|
- // overflow-x: auto;
|
|
|
+ overflow: auto;
|
|
|
}
|
|
|
table {
|
|
|
width: 100%;
|
|
|
font-size: 14px;
|
|
|
color: #666;
|
|
|
- table-layout: fixed;
|
|
|
td,
|
|
|
th {
|
|
|
// min-width: 120px;
|
|
|
word-break: break-all;
|
|
|
word-wrap: break-word;
|
|
|
+ line-height: 1.2em;
|
|
|
border: 1px solid #dcdfe6;
|
|
|
// height: 40px;
|
|
|
text-align: center;
|
|
@@ -125,4 +137,19 @@ table {
|
|
|
span { display: inline; }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.pc-sty table {
|
|
|
+ table-layout: fixed;
|
|
|
+ td,th {
|
|
|
+ height: auto;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.mobile-sty table {
|
|
|
+ table-layout: auto;
|
|
|
+ td,th {
|
|
|
+ min-width: 120px;
|
|
|
+ height: 40px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|