File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/components/ToggleBasic Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @impvis/components" ,
3- "version" : " 1.1.9 " ,
3+ "version" : " 1.2.0 " ,
44 "license" : " BSD-3-Clause" ,
55 "main" : " ./dist/impvis-components.js" ,
66 "unpkg" : " ./dist/impvis-components.umd.js" ,
Original file line number Diff line number Diff line change @@ -25,24 +25,29 @@ export default {
2525 props: {
2626 value: {
2727 type: Boolean ,
28- required: true
28+ default: false
29+ }
30+ },
31+ data (){
32+ return {
33+ toggleValue: this .value
2934 }
3035 },
3136 computed: {
3237 backgroundStyles () {
3338 return {
34- ' switchedOn' : this .value ,
35- ' switchedOff' : ! this .value
39+ ' switchedOn' : this .toggleValue ,
40+ ' switchedOff' : ! this .toggleValue
3641 };
3742 },
3843 indicatorStyles () {
39- return { transform: this .value ? ' translateX(14px)' : ' translateX(0)' };
44+ return { transform: this .toggleValue ? ' translateX(14px)' : ' translateX(0)' };
4045 }
4146 },
4247 methods: {
4348 toggle () {
44- this .value = ! this .value
45- this .$emit (' input' , ! this .value );
49+ this .toggleValue = ! this .toggleValue
50+ this .$emit (' input' , ! this .toggleValue );
4651 }
4752 }
4853};
You can’t perform that action at this time.
0 commit comments