63 lines
1001 B
Vue
63 lines
1001 B
Vue
<script>
|
||
module.exports = {
|
||
name: "TableColumn",
|
||
props: {
|
||
label: {
|
||
type: String,
|
||
default: ""
|
||
},
|
||
value: {
|
||
type: [String, Number],
|
||
required: false
|
||
},
|
||
label_suffix:{
|
||
type: String,
|
||
default: ":"
|
||
}
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="table-column">
|
||
<!-- 左侧 Label -->
|
||
<div class="label">
|
||
<slot name="label">
|
||
{{ label }}
|
||
{{label_suffix}}
|
||
</slot>
|
||
</div>
|
||
<!-- 右侧 Value -->
|
||
<div class="value">
|
||
<slot>{{ value }}</slot>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.table-column {
|
||
display: flex;
|
||
padding: 6px 0;
|
||
/*align-items: center;*/
|
||
}
|
||
|
||
.label {
|
||
color: #333;
|
||
font-size: 14px;
|
||
flex-shrink: 0;
|
||
max-width: 120px;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.value {
|
||
color: #555;
|
||
font-size: 14px;
|
||
flex-grow: 1; /* 动态占据剩余部分 */
|
||
/*white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;*/
|
||
}
|
||
</style>
|