- Vue.js 2 Web Development Projects
- Guillaume Chau
- 146字
- 2021-07-02 22:34:25
Displaying HTML
Now that we know that text interpolations can't render HTML for security reasons, we will need another way to render dynamic HTML--the v-html directive. Like the v-model directive we saw in Chapter 1, Getting Started with Vue, this is a special attribute that adds a new feature to our template. This one is able to render any valid HTML string into our app. Just pass the string as the value, as follows:
<!-- Preview pane --> <aside class="preview" v-html="notePreview"> </aside>
Now, the markdown preview should work correctly, and the HTML is dynamically inserted in our page.
Any content inside our aside element will be replaced by the value of the v-html directive. You can use this to put placeholder contents inside.
Here is the result you should have:

There is an equivalent directive for text interpolation, v-text, which behaves like v-html, but escapes the HTML tags just like classic text interpolations.
- Node.js 10實戰
- 數據庫原理及應用(Access版)第3版
- 編寫整潔的Python代碼(第2版)
- 網店設計看這本就夠了
- 嚴密系統設計:方法、趨勢與挑戰
- QGIS:Becoming a GIS Power User
- Python忍者秘籍
- CRYENGINE Game Development Blueprints
- RocketMQ實戰與原理解析
- C編程技巧:117個問題解決方案示例
- RESTful Web Clients:基于超媒體的可復用客戶端
- Drupal 8 Development Cookbook(Second Edition)
- HTML5 WebSocket權威指南
- 零基礎C語言學習筆記
- 劍指大數據:企業級電商數據倉庫項目實戰(精華版)