Open SuperIbm opened 3 years ago
I have the same issue. When I do this.$refs.runtimetemplate.$children[0].$children[0].function()
it runs the function but instantly rerenders new components with the original state. (it seems so, as they have new _uids)
I ended up ditching v-runtime-template and doing something like that:
<template v-for="block in content.body" >
<component
:is="'templatename'"
:key="block.date"
:block="block"
></component>
</template>
I use the helper function and it is working fine for me but I need to attach a ref to the template.
getRef(ref) {
const { root } = this.$refs;
if (root.$refs && root.$refs[ref]) {
return root.$refs[ref];
}
return root.$children[0].$refs[ref];
},
while using <v-runtime-template ref="root" ... />
If you have
ref
parameters in a template that you want to compile withv-runtime-template
you cannot have access to the element withthis.$refs
in your code.