K
K
Kagtaviy2017-03-04 05:34:05
JavaScript
Kagtaviy, 2017-03-04 05:34:05

How to properly use components with routing?

Hello.
I can't figure out how to use components and routing correctly.
I want to use routing from vuejs, my logic is that when going to "/main" for example, vuejs will load the parent component in id="content". will contain local components with their own templates.
I don't quite understand how to do it right.
I read the documentation several times, but still, I could not understand: from
HTML:

<div class="center-n" id="content">
        <main-pg>
        </main-pg>
    </div>

vuejs:
var live = Vue.component('main-pg', {
    template: '#live'
});

new Vue({
    el: '#content',
})

and everything stalled.
Please explain to whom it is not difficult: 3
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question