I know this is a strange question, but I’m storing BF Schema in FileMaker tables and am conditionally rendering them based on various criteria. Since the schema is being edited in FileMaker, I’m trying to make it easy to configure a list of links, so I’m trying to store the links as a json array, which is much easier (for the user configuring this in FM) than creating the html directly. I tried the below JSON in a form, but it doesn’t render; I’m guessing this doesn’t exist/reference the element JSON in the context of a template, but I’m not sure.
{
"html": "<p v-for=\"link in this.links\"><a class='anchor' :href='link.url' :title='link.title' target='_blank'>{{link.title}}</a></p>",
"styleClasses": "w-full",
"links": [{
"url": "http://telepark.bbc",
"title": "nostrud culpa voluptate ullamco nisi esse"
}, {
"url": "http://elentrix.pro",
"title": "est aliqua"
}, {
"url": "http://isodrive.cars",
"title": "magna elit adipisicing ipsum occaecat ut ea eiusmod"
}
],
"type": "html"
}
There are a number of ways to do this.
If you are passing HTML from the server and rendering in BF, then model and app data objects will be accessible. So you should be able to use that in your v-for.
BF HTML can not ‘see’ the schema as you have it, but it can see the model etc.
If you don’t need to have the source HTML come from the server ( more static ) then you can of course just pass the data in the app or model and render as you would anything else ( including all the conditionals etc too ).
Thanks for that info; I was afraid that was the case, but wasn’t sure. I know I can access the schema from a _calc, so I was hoping I could do so from a template as well, but I guess not.
That said, I was able to get this to work with a component. I basically used the same schema I posted earlier, but changed type to bfcomponent, added a name key, then moved the html to a component (and replaced this with schema).
Looks like my original example does work if I change this.links to schema.links!
For my own future reference, I’ll also add that you can access the element schema from all of these places in BF via the corresponding code below:
(where they are all accessing the links array, for consistency with my original question)