zrg
6 天以前 fb0d024283a24042e55c70019dffbcd104792135
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<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>