javascript - How to show formatted html string using vue.js - Stack Overflow

I have this problem, I created a html page to show some texts formatted using quill editor.I save ever

I have this problem, I created a html page to show some texts formatted using quill editor. I save every text created in a table using this format as example:

<p>Test<strong> format</strong></p>

To show the text in my front end, I'm using a v-for with vue.js, like this:

<div class="card" v-for="(wiki, index) in wikiList">
   <div class="mb-3">
       <div class="form-control" type="text" id="view-container-wiki" readonly>{{wiki.description}}</input>
   </div>
</div>

The problem is that my html is not formatting the text, its just showing it with tags:

How can I create a method to return the string formatted ? I tried using Jquery, but it didn't work.

Any suggestion ?

I have this problem, I created a html page to show some texts formatted using quill editor. I save every text created in a table using this format as example:

<p>Test<strong> format</strong></p>

To show the text in my front end, I'm using a v-for with vue.js, like this:

<div class="card" v-for="(wiki, index) in wikiList">
   <div class="mb-3">
       <div class="form-control" type="text" id="view-container-wiki" readonly>{{wiki.description}}</input>
   </div>
</div>

The problem is that my html is not formatting the text, its just showing it with tags:

How can I create a method to return the string formatted ? I tried using Jquery, but it didn't work.

Any suggestion ?

Share Improve this question edited May 23, 2022 at 8:15 Nikola Pavicevic 23.5k9 gold badges29 silver badges51 bronze badges asked Oct 8, 2021 at 13:41 NewProgrammerNewProgrammer 4525 silver badges19 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Try to use v-html directive :

 <div class="form-control" 
      type="text" id="view-container-wiki" 
      readonly 
      v-html="wiki.description">
 </div>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745358914a4624270.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信