是否可以将 HTML 添加到 Vue.js 中的插槽字符串中?



我已经使用 Vue 制作了一个扩展器组件.js我需要换行一些答案。如何将换行标记正确添加到插槽字符串中?截至目前,它们自然显示为字符串:

<expander identifier="pricing" question="This a question?" answer="This is an answer that really needs a <br/> tag."></expander>

您可以将white-space: pre-wrap样式应用于要将答案字符串呈现到的元素,然后可以在答案字符串中使用换行符,如下所示:

<expander :answer="'This is an answer that really needs a n tag.'"></expander>

最新更新