You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <div class="tw-flex tw-flex-col"> <label class="tw-body-4 container-checkbox" :for="input.id"> {{ $t(input.label) }} <input :id="input.id" type="checkbox" :value="value" v-model="inputVal" /> <span class="checkmark"></span> </label> </div> </template> <script> export default { name: "ElementCheckBox", props: { input: { type: Object, }, default: { type: String, }, }, data() { return { value: null, }; }, mounted() { }, watch: { default: { handler: function () { this.value = this.default; }, }, }, computed: { inputVal: { get() { return this.value; }, set(val) { this.value = val; this.$emit("update", val); }, }, }, }; </script> <style lang="scss" scoped> /* The container */ .container-checkbox { display: block; position: relative; padding-left: 37px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
/* Hide the browser's default checkbox */ .container-checkbox input { position: absolute; opacity: 0; cursor: pointer; }
/* Create a custom checkbox */ .container-checkbox .checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: transparent; border: 1px solid #f48800; border-radius: 4px; }
/* On mouse-over, add a grey background color */ .container-checkbox:hover input~.checkmark { border-color: #f48800; }
/* When the checkbox is checked, add a blue background */ .container-checkbox input:checked~.checkmark { background-color: #f48800; border-color: #f48800; }
/* Create the checkmark/indicator (hidden when not checked) */ .container-checkbox .checkmark:after { content: ""; position: absolute; display: none; }
/* Show the checkmark when checked */ .container-checkbox input:checked~.checkmark:after { display: block; }
/* Style the checkmark/indicator */ .container-checkbox .checkmark:after { left: 5px; top: 2px; width: 5px; height: 10px; border: solid #ffffff; border-width: 0 2px 2px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } </style>
|