VueJS Passing data Through render
Here is one way.
<div id="app" data-initial-value="125"></div>new Vue({ el: '#app', render: h => h(App, { props:{ id: document.querySelector("#app").dataset.initialValue } })})
But you don't have to use a render function.
new Vue({ el: '#app', template:"<app :id='id'></app>", data:{ id: document.querySelector("#app").dataset.initialValue }, components:{ App }})
Also, I'm using querySelector
assuming you rendered initialValue
(instead of id
) to the page as an attribute, but you could just as easily put it somewhere else on the page like a hidden input or something. Really doesn't matter.