vue-hot-reload-api
vue-hot-reload-api copied to clipboard
rerender throws an exception when component options are missing a render function
trafficstars
Hi everyone, I'm having an issue with rerender.
In the readme.md file, you provided a sample component options.
const myComponentOptions = {
data () { ... },
created () { ... },
render () { ... }
}
However, my object does not have a render function. It's using a template, instead. Here's a sample:
const componentOptions = {
data() { return { foo: 'bar' }; },
template: '<div>foo value is: {{ foo }}</div>'
};
When I try to rerender it, an exception occurs because the render function is missing.
The reload method is working perfectly fine though.
Here's a repro: https://github.com/BrightSoul/vue-hot-reload-api-issue-repro
I am aware that an easy solution to this is to just rewrite my component options like this:
const componentOptions = {
data() { return { foo: 'bar' }; },
...Vue.compile('<div>foo value is: {{ foo }}</div>')
};
But I was wondering whether the difference in behavior between reload and rerender is intended or not.