File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11<template >
2- <section class =" wrapper" @click =" toggled = !toggled" >
3- <span v-if =" location === 'left'" class =" title" >{{ title }}</span >
2+ <section class =" wrapper" >
43 <input
54 :id =" id"
65 v-model =" toggled"
76 :name =" name ? name : false"
87 class =" toggle"
98 type =" checkbox"
9+ @click =" toggle()"
1010 />
1111 <label :for =" id" class =" toggler" />
12- <span v-if = " location === 'right' " class =" title" >{{ title }}</ span >
12+ <span class = " title " @click = " toggle() " v-text =" title" / >
1313 </section >
1414</template >
1515
1616<script >
17+
1718export default {
1819 name: ' VueToggle' ,
1920
2021 props: {
2122 title: { type: String , required: true },
2223 name: { type: String , required: false },
2324 id: { type: Number , required: true },
24- location: { type: String , default: ' right' },
2525 },
2626
2727 data () {
2828 return { toggled: false }
2929 },
30+
31+ methods: {
32+ toggle : () => this .toggled = ! this .toggled ,
33+ },
3034}
3135 </script >
3236
You can’t perform that action at this time.
0 commit comments