v-if vs. v-show & v-html

v-if vs. v-show差異 在連結中提及:
https://vuejs.org/v2/guide/conditional.html

小結:DOM toggle很頻繁時用v-show較好;反之用v-if較好。


v-html使用時需注意XSS:
https://vuejs.org/v2/guide/syntax.html#Raw-HTML

小結:官網中擷取這句「Only use HTML interpolation on trusted content and never on user-provided content」。但如果無論如何都要用的話,也可去google相關解法。



留言

熱門文章