Implement edit callback, fist step

This commit is contained in:
Wolfgang Huß 2021-11-08 13:59:26 +01:00
parent 58464fd53e
commit 280f0f5a78
2 changed files with 25 additions and 2 deletions

View File

@ -106,6 +106,10 @@ export default {
type: Object,
default: () => ({}),
},
callbackEdit: {
type: Function,
default: () => {},
},
},
data() {
return {
@ -155,7 +159,9 @@ export default {
},
handleEditSocialMedia(link) {
this.editingLink = link
this.formData.socialMediaUrl = link.url
// Wolle this.formData.socialMediaUrl = link.url
// Wolle this.$refs.socialMediaUrl.$el.focus()
this.callbackEdit(this, link)
},
handleInput(data) {
this.disabled = true

View File

@ -1,5 +1,9 @@
<template>
<my-something-list :useFormData="useFormData" :useFormSchema="useFormSchema">
<my-something-list
:useFormData="useFormData"
:useFormSchema="useFormSchema"
:callbackEdit="callbackEditSocialMedia"
>
<template #list-item="{ link }">
<social-media-list-item :link="link" />
</template>
@ -36,5 +40,18 @@ export default {
},
}
},
methods: {
callbackEditSocialMedia(thisMySomethingList, link) {
// Wolle this.editingLink = link
thisMySomethingList.formData.socialMediaUrl = link.url
// thisMySomethingList.$refs.socialMediaUrl.$el.focus()
// !!! Check for existenz
// this.$scopedSlots.default()[0].context.$refs
// thisMySomethingList.$scopedSlots['edit-item']()[0].$el.focus()
// console.log(thisMySomethingList.$scopedSlots['edit-item']()[0].context.$refs)
// console.log(thisMySomethingList.$scopedSlots['edit-item']()[0].context.$refs)
// console.log(thisMySomethingList.$refs)
},
},
}
</script>