11<template >
2- <section class =" wrapper" >
2+ <section class =" wrapper" @click = " toggled = !toggled " >
33 <span v-if =" location === 'left'" class =" title" >{{ title }}</span >
44 <input
55 :id =" id"
66 v-model =" toggled"
7- :name =" name"
7+ :name =" name ? name : false "
88 class =" toggle"
99 type =" checkbox"
10- @click =" toggled = !toggled"
1110 />
1211 <label :for =" id" class =" toggler" />
1312 <span v-if =" location === 'right'" class =" title" >{{ title }}</span >
@@ -20,39 +19,34 @@ export default {
2019
2120 props: {
2221 title: { type: String , required: true },
23- name: { type: String , default : null },
22+ name: { type: String , required : false },
2423 id: { type: Number , required: true },
2524 location: { type: String , default: ' right' },
2625 },
2726
2827 data () {
29- return {
30- toggled: false ,
31- }
28+ return { toggled: false }
3229 },
3330}
3431 </script >
3532
3633<style lang="scss" scoped>
3734
38- $height : 2em ;
39- $background : #F0F0F0 ;
40- $succesful-toggle-color : #9FD6AE ;
41-
4235.wrapper {
4336 display : flex ;
4437 flex-wrap : wrap ;
4538 padding : 5px ;
4639
4740 > * {
41+ cursor : pointer ;
4842 margin : 0 5px ;
4943 }
5044}
5145
5246.title {
5347 display : inline-block ;
5448 font-weight : 700 ;
55- line-height : $height ;
49+ line-height : 2 em ;
5650 vertical-align : middle ;
5751}
5852
@@ -74,9 +68,8 @@ $succesful-toggle-color: #9FD6AE;
7468 }
7569
7670 + .toggler {
77- background : $background ;
71+ background : #F0F0F0 ;
7872 border-radius : 2em ;
79- cursor : pointer ;
8073 display : block ;
8174 height : 2em ;
8275 outline : 0 ;
@@ -106,7 +99,7 @@ $succesful-toggle-color: #9FD6AE;
10699 }
107100
108101 & :checked + .toggler {
109- background : $succesful-toggle-color ;
102+ background : #9FD6AE ;
110103 }
111104
112105 & :checked + .toggler :after {
0 commit comments