Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptVue.js v-pre Directive

Vue.js v-pre Directive

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;">
            neveropen
        </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:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments