Open In App

Vue.js v-pre Directive

Improve
Improve
Like Article
Like
Save
Share
Report

The v-pre directive is a Vue.js directive used to skip compilation for this element and all its children. You can use this for displaying raw mustache tags. First, we will create a div element with id as app and let’s apply the v-pre directive to an element. Further, we can use a heading element to show the data.

Syntax:

v-pre

Parameters: This directive doesn’t accept any parameter.

Example: This example uses Vue.js to show the working of v-pre directive.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        VueJS | v-pre directive
    </title>
  
    <!-- Load Vuejs -->
    <script src=
    </script>
</head>
  
<body>
    <div style="text-align: center;width: 600px;">
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <b>
            VueJS | v-pre directive
        </b>
    </div>
  
    <div id="canvas" style=
        "border:1px solid #000000;
        width: 600px;height: 200px;">
  
        <div id="app" style="text-align: center; 
                    padding-top: 40px;">
            <h1 v-pre>{{ data }}</h1>
        </div>
    </div>
  
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                data: 'Hello'
            }
        })
    </script>
</body>
  
</html>                   


Output:



Last Updated : 18 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads