Vue directives v-html and v-text

Vue directives v-html and v-text

1. v-text text rendering instructions

(Can only render text, not labels)


<div id="test">

        <p v-text="message"></p>

 </div>

 <script src="./js/vue.js"></script>

 <script>
    const vm = new Vue({

            el:"#test",

            data:{

                message:"<h2>hello vue</h2>"

            }

        })

 </script>

The output is:

2. v-html

(Can render instructions, can render tags)


<div id="test">

        <p v-html="message"></p>

 </div>

 <script src="./js/vue.js"></script>

 <script>

    const vm = new Vue({

            el:"#test",

            data:{

                message:"<h2>hello vue</h2>"

            }

        }) 

 </script>

The output is:

This is the end of this article about the Vue directives v-html and v-text. For more related v-html and v-text content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed examples of Vue instructions: v-cloak, v-text, v-html
  • Detailed explanation of the differences and applications of {{}}, v-text and v-html in Vue
  • Detailed code examples of using v-text / v-html in vue
  • Vue prevents curly braces {{}} from flashing v-text and v-html, v-cloak usage examples
  • Vue learning notes: detailed explanation of v-text && v-html && v-bind

<<:  Detailed explanation of the difference between device-width and width in CSS3 media queries

>>:  Use js in html to get the local system time

Recommend

Detailed explanation of the usage of image tags in HTML

In HTML, the <img> tag is used to define an...

Mysql error: Too many connections solution

MySQL database too many connections This error ob...

How to completely uninstall mysql under CentOS

This article records the complete uninstallation ...

Ubuntu 20.04 turns on hidden recording noise reduction function (recommended)

Recently, when using kazam in Ubuntu 20.04 for re...

Solution to the problem of failure to insert emoji expressions into MySQL

Preface I always thought that UTF-8 was a univers...

Detailed explanation of Nginx access restriction configuration

What is Nginx access restriction configuration Ng...

A brief analysis of the matching priority of Nginx configuration location

Preface The location in the server block in the N...

36 principles of MySQL database development (summary)

Preface These principles are summarized from actu...

Why Seconds_Behind_Master is still 0 when MySQL synchronization delay occurs

Table of contents Problem Description Principle A...

Detailed explanation of the use of MySQL DML statements

Preface: In the previous article, we mainly intro...

Detailed explanation of MySQL delayed replication library method

Simply put, delayed replication is to set a fixed...

Detailed explanation of the execution order of JavaScript Alert function

Table of contents question analyze solve Replace ...

VM VirtualBox virtual machine mount shared folder

One environment Install VMware Tools on CentOS 7 ...