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

Cannot convert undefined or null to object #30

Closed Duncank closed 5 years ago

Duncank commented 5 years ago

I'm getting a lot of cannot convert undefined or null to object-errors causing templates not to render. I've tracked this down to the render function starting on line 34 in v-runtime-template.es.js.

The function calls Object.keys() for a couple of properties; the computed-properties-one is failing for me, because that is undefined instead of an object.

I've changed line 43:

var computed = $options.computed;

to

var computed = $options.computed || {};

which fixes it for me. Hopefully an object-check or fallback like this can make it into this plugin.