Fraction of a second unparsed {variable}
Closed this issue · 2 comments
First of all kudos for your work as this is an awesome library.
I noticed one small thing though. Before reLift mounts into the page, you can see the unparsed {variable} for a fraction of a second.
You can check it here by clicking the Run button:
https://jsfiddle.net/hdfup3cg/
Vue, for example, has something called v-cloak
, that is an attribute that you can add to an element you want to hide, while Vue is mounting.
Is there anything similar for reLift?
Never mind, this can be actually solved very easily with something like this:
created() {
const el = document.getElementById('root');
el.setAttribute("style", "display:visible");
},
Full example here:
https://jsfiddle.net/rx0dupgh/
Hi,
You got the answer right. You don't even have to do it yourself, reLift internally will set display:block
of the element. Without doing anything in created()
, the snippet below will achieve the same thing. All you need to do is have the element hidden.
<div id="root" style="display:none">...</div>
reLiftHTML({
el: `#root`,
...
})