[Vuejs]-Cannot read property replace of null method parameter

2👍

As a rule of thumb, you shouldn’t use methods on the display side. Keep them for the update side – processing changes back into a store and such. Methods aren’t reactive – they need to be called. You want your display to automatically reflect some underlying data, so you should use computed.

You should also avoid using v-html, because you end up with markup outside your templates, and that markup is static. It’s not totally clear to me what will be in v-html, but you should try and keep markup in your template, and inject values using data, props or computed. Hope this helps!

If you want a div with some text that magically turns into an image tag, this could be a good use for <component :is>.

Leave a comment