<template>
|
<transition name="todostyle" appear>
|
<li class="todo-item">
|
<checkbox-group v-for="(item, index) in todoItem" :key="item.HID" @change="onCheckboxChange(item.是否选中,item.HID) ">
|
<label class="radio-option" v-show="item.是否启用">
|
<checkbox :checked="item.是否选中" />
|
<text class="item-text" >{{item.代码项目}}</text>
|
<button class="delete-btn" @click="deleteItem(item)">删除</button>
|
</label>
|
</checkbox-group>
|
</li>
|
</transition>
|
</template>
|
|
<script>
|
|
|
export default {
|
props: {
|
todoItem: {
|
type: Array,
|
required: true
|
}
|
},
|
data() {
|
return {
|
checkedIds: [] ,
|
}
|
},
|
methods: {
|
deleteItem(item)
|
{
|
uni.$emit("deleteItem", item.HID);
|
console.log("删除项ID:", item.HID);
|
},
|
onCheckboxChange(checked, HID)
|
{
|
console.log("当前选中项ID:",checked, HID);
|
uni.$emit("changeItem",checked, HID);
|
}
|
},
|
|
}
|
</script>
|
|
<style scoped>
|
.todo-item {
|
list-style: none;
|
margin: 12px 0;
|
padding: 0;
|
background-color: #fff;
|
border-radius: 12px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
overflow: hidden;
|
}
|
|
.radio-option {
|
display: flex;
|
align-items: center;
|
padding: 14px 16px;
|
border-bottom: 1px solid #f0f0f0;
|
transition: background 0.2s;
|
}
|
|
.radio-option:last-child {
|
border-bottom: none;
|
}
|
.radio-option:hover {
|
background-color: #fafafa;
|
}
|
|
radio {
|
transform: scale(0.9);
|
margin-right: 8px;
|
}
|
|
.item-text {
|
flex: 1;
|
font-size: 16px;
|
color: #333;
|
word-break: break-word;
|
}
|
|
.delete-btn {
|
background-color: #ff5a5f;
|
color: white;
|
border: none;
|
border-radius: 20px;
|
padding: 6px 16px;
|
font-size: 14px;
|
font-weight: 500;
|
line-height: 1.2;
|
box-shadow: 0 2px 6px rgba(255, 90, 95, 0.3);
|
transition: opacity 0.2s;
|
cursor: pointer;
|
}
|
|
.delete-btn:active {
|
opacity: 0.7;
|
}
|
|
|
button.delete-btn::after {
|
border: none;
|
}
|
.todostyle-enter-active {
|
transition: all 0.3s linear;
|
}
|
.todostyle-leave-active{
|
transition: all 0.3s linear reverse;
|
}
|
@keyframes todostyle-enter {
|
0% {
|
opacity: 0;
|
transform: translateX(120px);
|
}
|
100% {
|
opacity: 1;
|
transform: translateX(0);
|
}
|
}
|
</style>
|