Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between routing inside v-btn and using router-link

I am learning Vue.js, and, following a tutorial, a is used to route the page to another. He used a button wrapped by this tag, and I found that using the routing directive inside the tag. I was wondering, what's the difference between this two ways of going from one page to another? Both of them seems to be producing the same behavior (and I am not sending or receiving any data when changing pages).

Codes for comparison:

Using v-btn

<v-btn :to="{name: 'songs-create'}" 
      dark medium right bottom fab absolute 
      class="pink" slot="action">
        <v-icon>add</v-icon>
    </v-btn>

Using router-link

<router-link :to="{name: 'Hello'}" tag="span" class="logo">Tab Tracker</router-link>

Thanks in advance!

like image 874
Artur Mello Avatar asked Sep 20 '17 04:09

Artur Mello


People also ask

What is routing in networking?

What is routing? Routing is the process of connecting various networks simultaneously. Routing, therefore, happens in the network layer. Routing process involves setting a path for data packets to move in a network or across multiple networks. Routers operate at Layer 3 of the OSI Model or the network layer.

What is the difference between V-BTN and router-link in vuetifyjs?

v-btn is a component of vuetifyjs whereas router-link is component of vue-router. When you use v-btn with to attribute by passing the path object, it internally uses the vue-router's router-link component's api. So v-btn wraps the functionality of router-link when it is used with to attribute.

Do I need a router to route traffic between different VLANs?

But in scenario where different Vlans wants to communicate .Router is required to route traffic between different Vlans . General by default different Vlan traffic won't communicate to each other . To make them accessable router or any layer3 device is mandate to route tràffic among VLANs

What is the difference between routing protocols and routed protocols?

While discussing about protocols, two terms are commonly used: routing protocols and routed protocols. A Routed Protocol is a network protocol which can be used to send the user data from one network to another network.


1 Answers

v-btn is a component of vuetifyjs whereas router-link is component of vue-router.

When you use v-btn with to attribute by passing the path object, it internally uses the vue-router's router-link component's api.

So v-btn wraps the functionality of router-link when it is used with to attribute.

The reason why he could have been used the v-btn is to accomplish some other stuff like button styles and handling other events etc.

like image 177
Thaadikkaaran Avatar answered Oct 04 '22 18:10

Thaadikkaaran