Skip to content

Commit

Permalink
PATCH: try another method of toogle unicity
Browse files Browse the repository at this point in the history
  • Loading branch information
Amoki committed Dec 6, 2021
1 parent dca99e7 commit e0f7c46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/BIMDataComponents/BIMDataToggle/BIMDataToggle.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<label
:for="`bimdata-toggle-${id}`"
:for="`bimdata-toggle-${uniqueId}`"
:class="{ active: modelValue, disabled }"
class="toggle__button"
>
<slot></slot>
<input
type="checkbox"
:disabled="disabled"
:id="`bimdata-toggle-${id}`"
:id="`bimdata-toggle-${uniqueId}`"
v-model="checkedValue"
/>
<span class="toggle__switch"></span>
Expand Down Expand Up @@ -38,9 +38,9 @@ export default {
id: null,
};
},
beforeCreate() {
created() {
// Math.random is random enough to avoid conflict
this.id = Math.random().toString();
this.uniqueId = Math.random().toString();
},
computed: {
checkedValue: {
Expand Down

0 comments on commit e0f7c46

Please sign in to comment.