otf: add data attributes and pass them in vue component

This commit is contained in:
2021-10-01 14:03:58 +02:00
parent 65782d3a6b
commit 75348f6ba7
3 changed files with 22 additions and 16 deletions

View File

@@ -1,8 +1,9 @@
<template>
<on-the-fly
action="action"
:type="type"
:id="id"
:type="context.type"
:id="context.id"
:action="context.action"
:buttonText="options.buttonText"
@saveFormOnTheFly="saveFormOnTheFly">
</on-the-fly>
</template>
@@ -22,16 +23,6 @@ export default {
},
options() {
return this.onTheFly.options;
},
// temp
action() {
return 'show'; // 'edit', 'create'
},
type() {
return 'person'; // 'thirdparty'
},
id() {
return 1613
}
},
mounted() {

View File

@@ -14,8 +14,14 @@ containers.forEach((container) => {
data() {
return {
onTheFly: {
context: {},
options: {}
context: {
action: container.dataset.action,
type: container.dataset.targetName,
id: parseInt(container.dataset.targetId),
},
options: {
buttonText: container.dataset.buttonText || null
}
}
}
}