71 lines
1.3 KiB
Vue
Raw Normal View History

2025-04-11 17:32:55 +08:00
<template>
<div class="c-is-check" :style="{ height: size, width: size }" :class="isVal ? 'act' : 'normal'">
<!-- @click.stop="doCheck" -->
<div class="check-icon">
<el-icon><Check /></el-icon>
</div>
</div>
</template>
<script setup>
import { ref, reactive, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();
const props = defineProps({
size: {
type: String,
default: '28px',
},
value: {
type: Boolean,
default: false,
},
});
let isVal = ref(props.value);
watch(
() => props.value,
() => {
isVal.value = props.value;
},
{
immediate: true,
}
);
const doCheck = () => {
// isVal.value = !isVal.value;
};
</script>
<style lang="scss" scoped>
.c-is-check {
position: relative;
2025-05-20 13:05:37 +08:00
display: inline-block;
width: 100%;
border-radius: 20%;
2025-04-11 17:32:55 +08:00
vertical-align: middle;
cursor: pointer;
&.normal {
border: 1px solid $color-999;
background: $color-fff;
}
&.act {
border: 1px solid $color-main;
background: $color-main;
}
.check-icon {
position: absolute;
top: 50%;
2025-05-20 13:05:37 +08:00
left: 50%;
2025-04-11 17:32:55 +08:00
transform: translate(-50%, -50%);
.el-icon {
font-size: 24px;
font-weight: bold;
2025-05-20 13:05:37 +08:00
color: $color-fff;
2025-04-11 17:32:55 +08:00
}
}
}
</style>