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

Convert Checkbox component to Composition API #126

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 29 additions & 38 deletions lib/components/base/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,36 @@
<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: '',
clickEvent: () => {},
collapsingToggleStyle: false,
}
)
Mysterious-Dev marked this conversation as resolved.
Show resolved Hide resolved

function toggle() {
if (!props.disabled) {
emit('update:modelValue', !props.modelValue)
}
}
</script>

<style lang="scss" scoped>
Expand Down