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

Use inside nested component #41

Closed Patrick-Remy closed 5 years ago

Patrick-Remy commented 5 years ago

Resolves #39 by allowing the parent passed as a new property parent (name can be considered to be more convenient):

<template>
    <my-custom-component>
        <v-runtime-template **:parent="this"** :template="template" />
    </my-custom-component>
</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>

Also resolves #22 as the parent property can be defined as a custom object containing the optional properties data, prop, options, or just {} for sandboxing.

Fixes #34 and fixes #31 by just defining them in the component:

  components: {},
  computed: {},
  methods: {},
theDyingMountain commented 5 years ago

Please add this to master branch quickly. I need these fixes for a project I'm currently working on.

gwumkt commented 5 years ago

When will it be Live?

alexjoverm commented 5 years ago

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