Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Convert Checkbox component to Composition API (#126)
Browse files Browse the repository at this point in the history
* Convert Checkbox component to Composition API

* Apply suggestions from brawaru

* Fix lint error

* Apply suggestions from brawaru
  • Loading branch information
Mysterious-Dev authored Nov 13, 2023
1 parent 6169ff9 commit 9211627
Showing 1 changed file with 30 additions and 38 deletions.
68 changes: 30 additions & 38 deletions lib/components/base/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,37 @@
<slot v-else />
</div>
</template>
<script setup>
<script setup lang="ts">
import { CheckIcon, DropdownIcon } from '@'
</script>
<script>
import { defineComponent } from 'vue'
export default defineComponent({
props: {
label: {
type: String,
default: '',
},
disabled: {
type: Boolean,
default: false,
},
description: {
type: String,
default: '',
},
modelValue: Boolean,
clickEvent: {
type: Function,
default: () => {},
},
collapsingToggleStyle: {
type: Boolean,
default: false,
},
},
emits: ['update:modelValue'],
methods: {
toggle() {
if (!this.disabled) {
this.$emit('update:modelValue', !this.modelValue)
}
},
},
})
const emit = defineEmits<{
'update:modelValue': [boolean]
}>()
const props = withDefaults(
defineProps<{
label: string
disabled?: boolean
description: string
modelValue: boolean
clickEvent?: () => void
collapsingToggleStyle?: boolean
}>(),
{
label: '',
disabled: false,
description: '',
modelValue: false,
clickEvent: () => {},
collapsingToggleStyle: false,
}
)
function toggle() {
if (!props.disabled) {
emit('update:modelValue', !props.modelValue)
}
}
</script>

<style lang="scss" scoped>
Expand Down

0 comments on commit 9211627

Please sign in to comment.