Vue Js Basics Components Example

Bootstrap 4 , Html , Css , Vue.Js

Nicesnippets

244

25-07-2020


Vue Js Basics Components Example

Hi Guys,

In this tutorial, I will explain you how to create basics components in vue js. I show basics components example in vue js. Components are reusable Vue instances with a name: in this case, <app>. We can use this component as a custom element inside a root Vue instance created with new Vue:

Example


<!DOCTYPE html>

<html>

<head>

<title>Vue Js Basics Components Example</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 v-bind:class="red">Vue Js Basics Components Example</h5>

</div>

<div class="card-body">

<div class="row">

<div class="col-md-12">

<app>

</app>

</div>

</div>

</div>

</div>

</div>

</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.18/vue.min.js"></script>

<script>

Vue.config.devtools = true

var app = new Vue({

el:'.app',

data: function () {

return {

count: 0

}

},

template: '<button v-on:click="count++" class="btn btn-success">You clicked me {{ count }} times.</button>'

})

</script>

</body>

</html>

It will help you...


Recommended Posts