Skip to content

All topics  /  Vue

Vue.Js v-model Example Tutorial

Vue ·

Hi Guys,

In this example,I will learn you how to use Vue.Js v-model. We will explain vue.js v-model example. Vue.js also provides the v-model directive that makes two-way binding between form input and app state a breeze. you can easliy use vue.js v-model.

Here, I will give you full example for simply use v-model in vue.js as bellow.

Vue.Js v-model Example Tutorial


<!DOCTYPE html>
<html>
<head>
  <title>Vue.Js v-model Example Tutorial</title>
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/css/bootstrap.min.css">
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body class="bg-dark">
  <div class="container">
    <div class="col-md-6 offset-md-3">
      <div class="card mt-5">
        <div class="card-header">
          <h5>Vue.Js v-model Example Tutorial</h5>
        </div>
        <div class="card-body">
          <div id="app">
            <p>{{ message }}</p>
        <input v-model="message" class="form-control">
          </div>
        </div>
      </div>
    </div>
  </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.18/vue.min.js"></script>
<script>  
new Vue({
  el: "#app",
  data: {
      message: 'Hi Dev Welcome to nicesnippets.com'
  }
})  
</script>
</body>
</html>

It will help you....