How to navigate to a different page on button click in Vue.js?(Programmatic Navigation)

We can navigate to a page when a button is clicked by using the $router property provided by the vue-router package. Specifically, $router comes with a push method that can be used for navigation to a different page. Let us look at an example to see how this works. We will begin by creating a new application using Vue CLI. ❯ vue create programmatic-navigation-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application....

March 3, 2023 · 2 min

How to style an active link in Vue.js? (with examples)

When using the <router-link> component of vue-router, it automatically applies two CSS classes called .router-link-active and .router-link-exact-active. The .router-link-active class gets applied even if there is a partial match in URL whereas, .router-link-exact-active gets applied only when there is an exact match of the path. In this article, we will look at how to style an active link using the .router-link-active class. We will begin by creating a new application using Vue CLI....

March 3, 2023 · 3 min

How to implement routing in Vue.js? with examples

To implement routing in a Vue application, we have to make use of the package vue-router. In this article, we will look at how to install the required package and also implementing routing in Vue application. We will begin by creating a new application using Vue CLI. ❯ vue create routing-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application....

March 3, 2023 · 3 min

How to make an HTTP request on page load in Vue.js?

We can make an HTTP request on page load by using the lifecycle method created(). The created() hook basically gets called when the components get created. The data properties are set up before the created() hook is called, making it a better option to make an external API request to initialize data properties. In this article, we will look at how to make an HTTP request when a page is loaded in Vue using created() lifecycle method....

March 2, 2023 · 2 min

How to make HTTP requests using axios in Vue.js?

In this article, we will look at how to make an HTTP request in Vue using axios library. We will begin by creating a new application using Vue CLI. ❯ vue create axios-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd axios-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

March 2, 2023 · 3 min

How to make an HTTP request in Vue.js using fetch API?

In this article, we will look at how to make a HTTP request in Vue using fetch API. We will begin by creating a new application using Vue CLI. ❯ vue create http-request-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd http-request-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

March 1, 2023 · 3 min

How to implement blur event in Vue? v-on:blur | @blur

In this article, we will look at how to work with blur event in Vue using the v-on:blur or @blur directive with examples. We will begin by creating a new application using Vue CLI. ❯ vue create blur-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd blur-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

March 1, 2023 · 1 min

How to work with radio buttons in Vue.js? (with examples)

In this article, we will look at how to work with the <input> element to create radio buttons in Vue. We will begin by creating a new application using Vue CLI. ❯ vue create radio-button-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd radio-button-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

March 1, 2023 · 2 min

How to work with checkboxes in Vue.js? (with examples)

In this article, we will look at how to work with the input element to create checkboxes in Vue. We will begin by creating a new application using Vue CLI. ❯ vue create checkbox-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd checkbox-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

March 1, 2023 · 2 min

How to work with dropdown select in Vue.js?

In this article, we will look at how to work with the <select> element to create dropdown list in Vue. We will begin by creating a new application using Vue CLI. ❯ vue create dropdown-select-demo Once, the installation is complete, we can navigate to the folder and run the server to load the application. ❯ cd dropdown-select-demo ❯ npm run serve This will run our server on port 8080 by default http://localhost:8080/...

February 28, 2023 · 3 min