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

Issue with vuelidate #15

Closed AlexanderSDavidson closed 5 years ago

AlexanderSDavidson commented 5 years ago

After installing vuelidate v-runtime-template now throws an error, they are in separate component.

    app.js:44784 [Vue warn]: Error in render: "TypeError: Cannot read property 'validations' of undefined"

found in

---> <VRuntimeTemplate

Any ideas? Is this a build problem?

Solinx commented 5 years ago

The issue comes down to v-runtime not having $options set on it's dynamically generated component, while Vuelidate expects $options to be present. I used this to avoid the error:

// Add a mock mixin to avoid issues between v-runtime-template and Vuelidate
Vue.mixin({
  data: function() {
    if (this && !this.$options) {
      this.$options = {};
    }
    return {}
  }
});
alexjoverm commented 5 years ago

Fixed by 1.7.0