base_ui/components/forms/SwitchComponent.vue
2025-02-01 13:04:55 +03:30

94 lines
2.2 KiB
Vue

<template>
<div class="row form-group" :key="$attrs.key">
<div :class="$attrs.labelClass ?? 'col-md-3'">
{{ localFormElement.label }}:
</div>
<div :class="[$attrs.inputClass ?? ' col-md-9']" class="d-flex">
<div class="custom-control custom-switch">
<input
type="checkbox"
@keydown.enter="$emit('keydown', $event)"
:placeholder="localFormElement.placeholder"
:id="localFormElement.key"
:name="localFormElement.key"
v-model="textValue"
class="custom-control-input"
/>
<label class="custom-control-label" :for="localFormElement.key"
>فعال</label
>
</div>
<label class="mb-0 me-2" :for="localFormElement.key">غیرفعال</label>
</div>
</div>
</template>
<script>
import formBuilderMixin from "@mixins/formBuilderMixin";
export default {
mixins: [formBuilderMixin],
};
</script>
<style lang="scss" scoped>
.task-admin-switch{
margin-top:0 !important;
}
/* .form-control {
height: auto !important;
} */
/*
.checkbox-4 {
width: 100px;
appearance: none;
height: 40px;
border-radius: 100px;
cursor: pointer;
background: #ffffff;
position: relative;
background: #e0e5ec;
box-shadow: 4px 4px 6px 0 rgba(255, 255, 255, 0.3),
-4px -4px 6px 0 rgba(116, 125, 136, 0.2),
inset -4px -4px 6px 0 rgba(255, 255, 255, 0.2),
inset 4px 4px 6px 0 rgba(0, 0, 0, 0.2);
transition: all 0.5s;
}
.checkbox-4::after {
content: "";
width: 30px;
height: 30px;
position: absolute;
left: 8px;
top: 5px;
border-radius: 100%;
background-color: #ffffff;
box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, 0.5),
7px 7px 20px 0px rgba(0, 0, 0, 0.1), 4px 4px 5px 0px rgba(0, 0, 0, 0.1);
transition: all 0.5s;
}
.checkbox-4:checked::after {
left: 65px;
}
.checkbox-4-pink:checked {
background: #fb2175;
}
.checkbox-4-danger:checked {
background: var(--danger);
}
.checkbox-4-success:checked {
background: var(--success);
}
.checkbox-4-info:checked {
background: var(--info);
}
.checkbox-4-dark:checked {
background: #1a1a1a;
}
.checkbox-4-magic:checked {
background: var(--magic);
} */
</style>