-
Notifications
You must be signed in to change notification settings - Fork 0
Rocket View Renderer
Ian Rothmann edited this page Aug 10, 2017
·
3 revisions
The renderer can display a record given a rocket form definition.
The renderer needs to receive:
- A form definition array
- Form data in
v-model
or:value
<rocket-view-renderer
:definition="def"
v-model="formData"
>
</rocket-form-renderer>
data : {
def : [...discussed next...]
formData : {
name : 'Ian'
}
This wiki page is dedicated to the definition array syntax.
Please note that the view renderer also takes a rocket form renderer definition.
Scoped slots could be used to include ANY custom code anywhere in the view. This is a 2 step process:
- Include a type
scoped-slot
as part of the form definition array and give it aname
. - Add the scoped slot inside the renderer in a template tag, referring to the provided name in the
slot
field.
definition : [
...
{'type' : 'scoped-slot', name : 'displaydata'},
...
]
<rocket-view-renderer :definition="def" v-model="data">
<template scope="data" slot="displaydata">
<code>{{data}}</code> <!-- You can do anything here -->
</template>
</rocket-view-renderer>
scope="data"
receives the record that was injected with :value
or v-model
. You may use it to display anything, like charts etc. In this case it is used to print the data object between code
tags.