Migrate Checkbox component to setup syntax
This commit is contained in:
parent
0b0f262b62
commit
f0a8b8f835
|
|
@ -1,5 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<label class="base-input-container">
|
<label
|
||||||
|
:data-checked="checked"
|
||||||
|
data-cy="base-input-container"
|
||||||
|
class="base-input-container"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
:checked="checked"
|
:checked="checked"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
@ -33,24 +37,19 @@
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
label: string;
|
||||||
|
checked: boolean;
|
||||||
|
item: any;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
const Tick = defineAsyncComponent(() => import('@/components/icons/Tick.vue'));
|
const Tick = defineAsyncComponent(() => import('@/components/icons/Tick.vue'));
|
||||||
const CircleIcon = defineAsyncComponent(() => import('@/components/icons/CircleIcon.vue'));
|
const CircleIcon = defineAsyncComponent(() => import('@/components/icons/CircleIcon.vue'));
|
||||||
|
|
||||||
export default {
|
defineProps<Props>();
|
||||||
props: {
|
defineEmits(['input']);
|
||||||
label: String,
|
|
||||||
checked: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
item: Object,
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Tick,
|
|
||||||
CircleIcon,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -10,26 +10,17 @@
|
||||||
</base-input>
|
</base-input>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
import BaseInput from '@/components/ui/BaseInput.vue';
|
import BaseInput from '@/components/ui/BaseInput.vue';
|
||||||
|
export interface Props {
|
||||||
|
label: string;
|
||||||
|
checked: boolean;
|
||||||
|
item: any;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
defineProps<Props>();
|
||||||
props: {
|
const emit = defineEmits(['input']);
|
||||||
label: String,
|
const passOn = (checked: boolean) => {
|
||||||
checked: {
|
emit('input', checked);
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
item: Object,
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
BaseInput,
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
passOn() {
|
|
||||||
this.$emit('input', ...arguments);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue