Search code snippets, questions, articles...

Define a new component in Vue.js

Vue.component('component_name', {
    props: ['prop_name'],
    template: '<div class="root"></div>',
    data: function() {
        return {}
    methods: {
    created: function() {
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

The code can be used to define a new component in Vue.js. You can use this component by creating tag named as component name as below.


Was this helpful?