alexjoverm / v-runtime-template

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

Property or method "test" is not defined on the instance but referenced during render. #79

Open treecon opened 3 years ago

treecon commented 3 years ago

EDIT: The problem occured cause v-runtime-template was child of vue-draggable-resizable component. Issue can be deleted.

In the following, simple case, I get the error in the title.

I am using Vue 2.x

<template>
    <div class="wrapper>
        <vue-draggable-resizable>
            <v-runtime-template :template="template"></v-runtime-template>
        </vue-draggable-resizable>
    </div>
</template>

<script>
import VRuntimeTemplate from "v-runtime-template";

export default {
    components: {VRuntimeTemplate},
    data() {
        return {
            template: '<h3>this is a {{test}}</h3>',
            test: 'abc',
        }
    }
}
</script>
4m1g0 commented 3 years ago

I wanted to say thank you. This helped me solve my problem. It was not obvious to me why this wouldn't work.