Convert Checkbox component to Composition API (#126)

* Convert Checkbox component to Composition API

* Apply suggestions from brawaru

* Fix lint error

* Apply suggestions from brawaru
This commit is contained in:
Mysterious_Dev
2023-11-13 21:06:42 +01:00
committed by GitHub
parent 6169ff99a2
commit 92116273b0

View File

@@ -23,45 +23,37 @@
<slot v-else /> <slot v-else />
</div> </div>
</template> </template>
<script setup> <script setup lang="ts">
import { CheckIcon, DropdownIcon } from '@' import { CheckIcon, DropdownIcon } from '@'
</script>
<script>
import { defineComponent } from 'vue'
export default defineComponent({ const emit = defineEmits<{
props: { 'update:modelValue': [boolean]
label: { }>()
type: String,
default: '', const props = withDefaults(
}, defineProps<{
disabled: { label: string
type: Boolean, disabled?: boolean
default: false, description: string
}, modelValue: boolean
description: { clickEvent?: () => void
type: String, collapsingToggleStyle?: boolean
default: '', }>(),
}, {
modelValue: Boolean, label: '',
clickEvent: { disabled: false,
type: Function, description: '',
default: () => {}, modelValue: false,
}, clickEvent: () => {},
collapsingToggleStyle: { collapsingToggleStyle: false,
type: Boolean, }
default: false, )
},
}, function toggle() {
emits: ['update:modelValue'], if (!props.disabled) {
methods: { emit('update:modelValue', !props.modelValue)
toggle() { }
if (!this.disabled) { }
this.$emit('update:modelValue', !this.modelValue)
}
},
},
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>