alexjoverm / v-runtime-template

Vue component for compiling templates on the fly using a v-html like API
MIT License
605 stars 72 forks source link

Can't find variable / use inside component #39

Closed Patrick-Remy closed 5 years ago

Patrick-Remy commented 5 years ago

Great project, thanks for your work! 👍
I try to use v-runtime-template inside a vuematerial/vue-material component, but I get the error ReferenceError: Can't find variable: visible.

<template>
     <!-- works: <v-runtime-template :template="template"></v-runtime-template> -->
    <md-card>
       <!-- doesn't work -->
        <v-runtime-template :template="template" />
    </md-card>
</template>

<script>
import Vue from 'vue'
import VRuntimeTemplate from 'v-runtime-template'

export default Vue.extend({
  components: {
    VRuntimeTemplate
  },
  data() {
    return {
      visible: true,
      template: '<p v-if="visible">Hello World!</p>'
    }
  }
})
</script>
alexjoverm commented 5 years ago

Fixed on 1.7.1 6289c88c6812df2037f3e138e35fad75c4fd71cc by using parent property. See #41