feat: add reactive employee amount based on rows length in WorkerItem component
This commit is contained in:
parent
5890f07d89
commit
033e2fc2f6
1 changed files with 11 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { QTableProps } from 'quasar';
|
||||
import TableComponents from 'src/components/TableComponents.vue';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const employeeAmount = defineModel<number>('employeeAmount', { default: 1 });
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ defineEmits<{
|
|||
(e: 'check', index: number): void;
|
||||
}>();
|
||||
|
||||
withDefaults(
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
readonly?: boolean;
|
||||
fallbackImg?: string;
|
||||
|
|
@ -85,6 +86,14 @@ const columns = [
|
|||
field: 'action',
|
||||
},
|
||||
] satisfies QTableProps['columns'];
|
||||
|
||||
watch(
|
||||
() => props.rows,
|
||||
() => {
|
||||
if (props.readonly) return;
|
||||
employeeAmount.value = props.rows.length;
|
||||
},
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
|
|
@ -175,6 +184,7 @@ const columns = [
|
|||
input-class="text-center"
|
||||
:readonly
|
||||
hide-bottom-space
|
||||
:min="rows.length"
|
||||
v-model="employeeAmount"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue