This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style scoped> | |
... | |
input:checked + .toggle { | |
background-color: rgb(67, 119, 211); | |
border: 2px solid rgb(67, 119, 211); | |
} | |
input:checked + .toggle:after { | |
background-color: #fff; | |
right: 2px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style scoped> | |
label { | |
display: inline-block; | |
width: 120px; | |
} | |
.toggle { | |
border: 2px solid black; | |
border-radius: 12px; | |
display: inline-block; | |
height: 16px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div @click="$emit('update:active', !active)"> | |
<label :for="id">{{ label }}</label> | |
<input type="checkbox" :name="name" :id="id" :checked="active" hidden aria-hidden="true"> | |
<div class="toggle"></div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style scoped> | |
label { | |
display: inline-block; | |
width: 120px; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<app-toggle :active.sync="toggleActive" label="Wifi"></app-toggle> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div @click="$emit('update:active', !active)"> | |
<label :for="id">{{ label }}</label> | |
<input type="checkbox" :name="name" :id="id" :checked="active"> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'Toggle', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div @click="$emit('update:active', !active)"> | |
<input type="checkbox" :name="name" :id="id" :checked="active"> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<app-toggle name="toggle" id="toggle-1" :active.sync="toggleActive"></app-toggle> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<app-toggle name="toggle" id="toggle-1" :active="toggleActive"></app-toggle> | |
</div> | |
</template> | |
<script> | |
import Toggle from './Toggle' | |
export default { | |
name: 'App', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<input type="checkbox" :name="name" :id="id" :checked="active"> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'Toggle', | |
props: { |
NewerOlder