I'm new to Vue.js, I just read the documentation on conditional rendering here (https://v2.vuejs.org/v2/guide/conditional.html) but somehow can't get it to work...
My code:
<button onclick="showTemplate()">Teste</button>
<template v-if="app">
<div id="app">
{{ message }}
</div>
</template>
function showTemplate(){
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
}
I want the template tag to render only after app has been instantiated. I have also tried variations of this code without success. Can someone help out?
v-ifon the template tag, which is outside of thedivwhich is having the Vue instance actually mounted to it. So I believe that that<template>tag will never have access to that Vue function, even after the Vue instance is created.