jiangchengfeiyi-Web/src/views/test.vue

87 lines
2.0 KiB
Vue
Raw Normal View History

2024-11-01 05:04:02 +00:00
<template>
2024-12-02 05:04:45 +00:00
<div class="date-picker">
<div class="father">
<div v-for="(item, index) in dayList" :key="index">
<div class="inner">
{{ index + 1 }}
</div>
<!-- 时间段部分 -->
<div class="time-picker">
<div v-for="(item, row) in timeList[index]" :key="row" class="box">
<span> {{ row+1 }} 个时间段</span>
<el-time-select
v-model="timeList[index][row].startTime"
style="width: 150px"
:max-time="timeList[index][row].endTime"
placeholder="Start time"
size="default"
start="08:30"
step="00:15"
end="18:30" />
<el-time-select
v-model="timeList[index][row].endTime"
style="width: 150px"
:min-time="timeList[index][row].startTime"
placeholder="End time"
size="default"
start="08:30"
step="00:15"
end="18:30" />
<el-button circle @click="addList(index, row)"><el-icon><Plus /></el-icon></el-button>
<el-button circle @click="subList(index, row)" v-if="row + 1 > 1"><el-icon><Minus /></el-icon></el-button>
</div>
</div>
</div>
</div>
2024-11-11 01:29:36 +00:00
</div>
2024-11-01 05:04:02 +00:00
</template>
2024-12-02 05:04:45 +00:00
<script setup lang="ts">
import { ref } from 'vue'
import { Plus } from '@element-plus/icons-vue';
const dayList = ref([0,1,2,3]) //今天和未来三天
const timeList = ref([
[
{
startTime: '',
endTime: ''
}
],
[
{
startTime: '',
endTime: ''
}
],
[
{
startTime: '',
endTime: ''
}
],
[
{
startTime: '',
endTime: ''
}
]
])
const numberRange = ref([])
const addList = (index: any, row: any) => {
if ( timeList.value[index].length < 6) {
timeList.value[index].push({
startTime:'',
endTime:''
})
}
}
const subList = (index: number, row: number) => {
console.log(index,row);
timeList.value[index].splice(row, 1)
}
2024-11-11 01:29:36 +00:00
</script>
2024-12-02 05:04:45 +00:00
<style lang="scss" scoped>
</style>