2019-08-16 10:16:43 -07:00
|
|
|
<template>
|
2020-02-27 10:27:58 -08:00
|
|
|
<div class="c-toggle-switch">
|
|
|
|
<label class="c-toggle-switch__control">
|
|
|
|
<input
|
|
|
|
:id="id"
|
|
|
|
type="checkbox"
|
|
|
|
:checked="checked"
|
|
|
|
@change="onUserSelect($event)"
|
|
|
|
>
|
|
|
|
<span class="c-toggle-switch__slider"></span>
|
|
|
|
</label>
|
|
|
|
<div
|
|
|
|
v-if="label && label.length"
|
|
|
|
class="c-toggle-switch__label"
|
2019-12-04 12:39:09 -08:00
|
|
|
>
|
2020-02-27 10:27:58 -08:00
|
|
|
{{ label }}
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-16 10:16:43 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-02-27 10:27:58 -08:00
|
|
|
|
2019-12-04 12:39:09 -08:00
|
|
|
export default {
|
|
|
|
inject: ['openmct'],
|
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2019-08-16 10:16:43 -07:00
|
|
|
},
|
2020-02-27 10:27:58 -08:00
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: ''
|
|
|
|
},
|
2019-12-04 12:39:09 -08:00
|
|
|
checked: Boolean
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onUserSelect(event) {
|
|
|
|
this.$emit('change', event.target.checked);
|
2019-08-16 10:16:43 -07:00
|
|
|
}
|
|
|
|
}
|
2019-12-04 12:39:09 -08:00
|
|
|
}
|
2020-02-27 10:27:58 -08:00
|
|
|
|
2019-12-04 12:39:09 -08:00
|
|
|
</script>
|