uni-ticket-system/src/components/display-box/index.vue

87 lines
1.9 KiB
Vue
Raw Normal View History

2023-12-07 05:07:01 +00:00
<template>
2023-12-18 07:50:44 +00:00
<div class="content2" :style="styleColor">
2023-12-07 05:07:01 +00:00
<div class="wrap1" v-for="item in result">
<div class="wrap1_1">
<slot :name="Object.keys(item).find(x=>x.includes('l'))"></slot>
</div>
<div class="wrap1_2">
<slot :name="Object.keys(item).find(x=>x.includes('r'))"></slot>
</div>
</div>
</div>
</template>
<script setup >
2023-12-18 07:50:44 +00:00
import {useSlots,ref,defineProps} from 'vue'
2023-12-07 05:07:01 +00:00
const slots = useSlots();
2023-12-18 07:50:44 +00:00
const prop=defineProps({
styleColor:{
type:Object,
default:()=>{
return {backgroundColor:'#fff'}
}
}
})
2023-12-07 05:07:01 +00:00
const groupObjectsByNumberKeys=(obj)=> {
const grouped = {};
for (const key in obj) {
const numericPart = key.slice(1);
if (!grouped[numericPart]) {
grouped[numericPart] = {};
}
grouped[numericPart][key] = obj[key];
}
return Object.values(grouped);
}
const result = ref(groupObjectsByNumberKeys(slots))
</script>
<style scoped lang="scss">
.content2{
2023-12-18 07:50:44 +00:00
2023-12-07 05:07:01 +00:00
border-radius: 20rpx;
padding-left: 18rpx;
padding-right: 32rpx;
.wrap1{
padding-left: 14rpx;
padding-top: 26rpx;
padding-bottom: 22rpx;
border-bottom: 1rpx solid #E4EAF1;;
display: flex;
2023-12-18 07:50:44 +00:00
&:last-child{
border-bottom: none;
}
2023-12-07 05:07:01 +00:00
.wrap1_2{
2023-12-18 07:50:44 +00:00
flex-grow: 1;
2023-12-07 05:07:01 +00:00
padding-left: 36rpx;
font-size: 24rpx;
color: #939393;
}
.wrap1_1{
2023-12-20 07:07:23 +00:00
padding-right: 30rpx;
box-sizing: border-box;
2023-12-07 05:07:01 +00:00
display: flex;
align-items: center;
width: 192rpx;
border-right: 1rpx solid #E4EAF1;
.wrap1_1_1{
font-size: 24rpx;
color: #626262;
margin-right: 12rpx;
}
.wrap1_1_2{
display: flex;
justify-content: center;
align-items: center;
font-size: 16rpx;
color: #fff;
width: 80rpx;
height: 28rpx;
background-color:#FFCD5C ;
border-radius: 24rpx;
}
}
}
}
</style>