diff options
| author | Henry Jameson <me@hjkos.com> | 2023-05-23 18:52:10 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-05-23 22:23:58 +0300 |
| commit | 99f85069b8a3bc44c3c0a5c6cac35dbfbd740dd5 (patch) | |
| tree | b5842c6d05ff07e9fc9c5e4c3995b044d52a04f6 /src/components/checkbox/checkbox.vue | |
| parent | 6b0d72937e19c87ea8a925b41a1475704bbd1a56 (diff) | |
fix indeterminate state animation
Diffstat (limited to 'src/components/checkbox/checkbox.vue')
| -rw-r--r-- | src/components/checkbox/checkbox.vue | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index 42f89be9..274e8d0b 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -1,7 +1,7 @@ <template> <label class="checkbox" - :class="{ disabled, indeterminate }" + :class="{ disabled, indeterminate, 'indeterminate-fix': indeterminateTransitionFix }" > <input type="checkbox" @@ -14,6 +14,7 @@ <i class="checkbox-indicator" :aria-hidden="true" + @transitionend.capture="onTransitionEnd" /> <span v-if="!!$slots.default" @@ -31,7 +32,22 @@ export default { 'indeterminate', 'disabled' ], - emits: ['update:modelValue'] + emits: ['update:modelValue'], + data: () => ({ + indeterminateTransitionFix: false + }), + watch: { + indeterminate (e) { + if (e) { + this.indeterminateTransitionFix = true + } + } + }, + methods: { + onTransitionEnd (e) { + this.indeterminateTransitionFix = false + } + } } </script> @@ -98,6 +114,12 @@ export default { } } + &.indeterminate-fix { + input[type="checkbox"] + .checkbox-indicator::before { + content: "–"; + } + } + & > span { margin-left: 0.5em; } |
