Fix another input event handler
This commit is contained in:
parent
588d92283e
commit
d7ab92af02
|
|
@ -11,44 +11,36 @@
|
||||||
:data-cy="cyId"
|
:data-cy="cyId"
|
||||||
:is="type"
|
:is="type"
|
||||||
:id="id"
|
:id="id"
|
||||||
@input="$emit('input', $event.target.value)"
|
@input="input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
export default {
|
import { computed } from 'vue';
|
||||||
props: {
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: 'input',
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
interface Props {
|
||||||
return {
|
label: string;
|
||||||
id: null,
|
type: string;
|
||||||
};
|
value: string;
|
||||||
},
|
}
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
type: 'input',
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['input']);
|
||||||
|
const classes = computed(() => {
|
||||||
|
return `page-form-input__${props.type} skillbox-${props.type}`;
|
||||||
|
});
|
||||||
|
const cyId = computed(() => {
|
||||||
|
return `page-form-input-${props.label.toLowerCase()}`;
|
||||||
|
});
|
||||||
|
|
||||||
computed: {
|
const id = '3'; //todo: make unique id
|
||||||
classes() {
|
|
||||||
return `page-form-input__${this.type} skillbox-${this.type}`;
|
|
||||||
},
|
|
||||||
cyId() {
|
|
||||||
return `page-form-input-${this.label.toLowerCase()}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
const input = (e: Event) => {
|
||||||
this.id = this._uid;
|
const value = (e.target as HTMLInputElement).value;
|
||||||
},
|
console.log(value);
|
||||||
|
emit('input', value);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<page-form-input
|
<page-form-input
|
||||||
label="Titel"
|
label="Titel"
|
||||||
:value="localRoom.title"
|
:value="localRoom.title"
|
||||||
@input="localRoom.title = $event"
|
@input="updateTitle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<page-form-input
|
<page-form-input
|
||||||
|
|
@ -76,6 +76,9 @@ export default {
|
||||||
this.localRoom.appearance = newColor;
|
this.localRoom.appearance = newColor;
|
||||||
this.$store.dispatch('setSpecialContainerClass', newColor);
|
this.$store.dispatch('setSpecialContainerClass', newColor);
|
||||||
},
|
},
|
||||||
|
updateTitle(title) {
|
||||||
|
this.localRoom.title = title;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,29 @@ function matomoRoomWithSlugCallback(route) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{ path: '/rooms', name: ROOMS_PAGE, component: rooms, meta: { filter: true, hideFooter: true, matomoUrl: '/room/' }},
|
{ path: '/rooms', name: ROOMS_PAGE, component: rooms, meta: { filter: true, hideFooter: true, matomoUrl: '/room/' } },
|
||||||
{ path: '/new-room/', name: NEW_ROOM_PAGE, component: newRoom },
|
{ path: '/new-room/', name: NEW_ROOM_PAGE, component: newRoom },
|
||||||
{ path: '/edit-room/:id', name: 'edit-room', component: editRoom, props: true },
|
{ path: '/edit-room/:id', name: 'edit-room', component: editRoom, props: true },
|
||||||
{ path: '/room/:slug', name: ROOM_PAGE, component: room, props: true, meta: { matomoUrlCallback: matomoRoomWithSlugCallback }},
|
{
|
||||||
{ path: '/room/:slug/add', name: ADD_ROOM_ENTRY_PAGE, component: newRoomEntry, props: true, meta: { matomoUrlCallback: matomoRoomWithSlugCallback }},
|
path: '/room/:slug',
|
||||||
{ path: '/room/:slug/edit/:entrySlug', name: UPDATE_ROOM_ENTRY_PAGE, component: editRoomEntry, meta: { matomoUrlCallback: matomoRoomWithSlugCallback }},
|
name: ROOM_PAGE,
|
||||||
|
component: room,
|
||||||
|
props: true,
|
||||||
|
meta: { matomoUrlCallback: matomoRoomWithSlugCallback },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/room/:slug/add',
|
||||||
|
name: ADD_ROOM_ENTRY_PAGE,
|
||||||
|
component: newRoomEntry,
|
||||||
|
props: true,
|
||||||
|
meta: { matomoUrlCallback: matomoRoomWithSlugCallback },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/room/:slug/edit/:entrySlug',
|
||||||
|
name: UPDATE_ROOM_ENTRY_PAGE,
|
||||||
|
component: editRoomEntry,
|
||||||
|
meta: { matomoUrlCallback: matomoRoomWithSlugCallback },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/module-room/:slug',
|
path: '/module-room/:slug',
|
||||||
name: MODULE_ROOM_PAGE,
|
name: MODULE_ROOM_PAGE,
|
||||||
Loading…
Reference in New Issue