Home Examples Charts Dashboard Projects Menu

Vue.js examples
Learn Vue.js

vuejs components

Related course:
Fullstack Vue: The Complete Guide to Vue.js

Vue Components are great: create your own HTML elements, encapsulated as an HTML tag.

An template can be created inside a component, the component itself can be used as a tag:

<div id="app">

vuejs components

Components need to be registered. You can add a components section to your app.
Inside this section you can define the tags that link to the component.

See the example below app.js:

var exampleComponent = {
template: '<div>
Component examples

new Vue({
el: '#app',
components: {
'example': exampleComponent
data: {
posts: []
methods: {

Then inside your template, index.html:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<!-- include vue -->
<script src="//unpkg.com/vue"></script>
<div id="app">
<script src="app.js"></script>

← vuejs ajax vuejs class →


© vuejsexamples.net - Privacy Policy - Cookie Policy