Migrate another component to use correct event emitting
This commit is contained in:
parent
f19ed06947
commit
92f9831cc1
|
|
@ -9,7 +9,7 @@
|
||||||
rows="1"
|
rows="1"
|
||||||
class="submission-form__textarea"
|
class="submission-form__textarea"
|
||||||
v-auto-grow
|
v-auto-grow
|
||||||
@input="$emit('input', $event.target.value)"
|
@input="input"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="submission-form__save-status submission-form__save-status--saved"
|
class="submission-form__save-status submission-form__save-status--saved"
|
||||||
|
|
@ -26,29 +26,27 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
const TickCircleIcon = defineAsyncComponent(() =>
|
const TickCircleIcon = defineAsyncComponent(() => import('@/components/icons/TickCircleIcon.vue'));
|
||||||
import('@/components/icons/TickCircleIcon.vue')
|
const LoadingIcon = defineAsyncComponent(() => import('@/components/icons/LoadingIcon.vue'));
|
||||||
);
|
|
||||||
const LoadingIcon = defineAsyncComponent(() =>
|
|
||||||
import('@/components/icons/LoadingIcon.vue')
|
|
||||||
);
|
|
||||||
|
|
||||||
export default {
|
interface Props {
|
||||||
props: {
|
inputText: string;
|
||||||
inputText: String,
|
saved: boolean;
|
||||||
saved: Boolean,
|
readonly: boolean;
|
||||||
readonly: Boolean,
|
placeholder: string;
|
||||||
placeholder: {
|
}
|
||||||
type: String,
|
|
||||||
default: 'Ergebnis erfassen',
|
withDefaults(defineProps<Props>(), {
|
||||||
},
|
placeholder: 'Ergebnis erfassen',
|
||||||
},
|
});
|
||||||
components: {
|
|
||||||
TickCircleIcon,
|
const emit = defineEmits(['input']);
|
||||||
LoadingIcon,
|
|
||||||
},
|
const input = (e: Event) => {
|
||||||
|
const value = (e.target as HTMLInputElement).value;
|
||||||
|
emit('input', value);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { getUniqueId } from '@/helpers/id';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
@ -35,11 +36,10 @@ const cyId = computed(() => {
|
||||||
return `page-form-input-${props.label.toLowerCase()}`;
|
return `page-form-input-${props.label.toLowerCase()}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const id = '3'; //todo: make unique id
|
const id = getUniqueId(); //todo: make unique id
|
||||||
|
|
||||||
const input = (e: Event) => {
|
const input = (e: Event) => {
|
||||||
const value = (e.target as HTMLInputElement).value;
|
const value = (e.target as HTMLInputElement).value;
|
||||||
console.log(value);
|
|
||||||
emit('input', value);
|
emit('input', value);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue