HTML & VueJS
Last updated
Last updated
The BetterForms framework allows you to dig deep into the low levels of HTML code and still keep the benefits of a framework and reactivity. Many components have html compatible keys or accept slots that allow HTML to be rendered. BetterForms uses VueJS under the hood to keep all the elements working together.
You can harness the full power of VueJS the html rendering engine inside of BetterForms but simply adding Vue html syntax into your HTML
code. When you use Vue, it maintains a link to the data in your data model and wherever that data is referenced so changes made to the data model will reflect instantly on the page.
Here's just a few things you can do with VueJS Syntax:
Render merged data from the data model
Build tables and other repeating data. (see example below)
Execute all actions and pass data to those actions.
{{curly-brackets}}
or not?The {{}} syntax is only for injecting JavaScript into HTML code. Everything that you stick inside of of the curly brackets is actually just JavaScript. Vue is the glue that allows you combine HTML and JS and dynamically insert data (as calculated by the JS) into the HTML of your page.
Remember: the contents of the curly brackets is a single line of JavaScript and must evaluate to return a value. However, you only need to add the curly brackets if you're trying to place the result of that value into HTML code.
BetterForms is bundled with the following JS libraries:
MomentJS - working with dates and times
NumeralJS - formatting numbers
Lodash - any useful function you can imagine
You can access these libraries anywhere where JavaScript can be inserted, including these curly brackets