Building Front-End App in Vue with Vuetify – Part 1

In this series, we will be building front-end app Currency Converter using Vue and Vuetify.

The code for this is here. Please note that the code has been committed under commits matching with Parts. So for complete code for this tutorial, please refer to commit branch “part-1”.

Pre-requisites:

  • Please ensure that npm-cli is installed. You can install node-js and it will install npm-cli as part of installation.
  • Please ensure that vue-cli is installed. I am using the v3 vue cli.

Create project
vue create cc
create a project named cc
this step will also prompt for some defaults.

  1. Preset: Manually select features -> here Make sure to check Router
  2. it will also prompt if you want history mode in router. Say Y. We will use this to not include # in vue router urls
  3. In the end, it will ask if you want to save the presets for other projects. I usually say no.

Check if everything went fine by running npm run serve

Then lets install Vuetify. I install Vuetify into vue as a plugin. This is the recommended way from vue-cli v3 onwards.
vue add vuetify

Run npm run serve again and make sure that default sit runs OK.

OK, so lets start coding.
First things first. We Look at src/views folder. This is the place we will be working most of the time. We will Notice that it has folder called views. In this folder go all the .vue that the router connects to. To see what router connects to, we goto router/index.js.

By default, it looks like this:

It is pretty self explanatory. We are good to go. We do observe that the two routes mentioned are home and about. And in the src/views folder we see Home.vue and About.vue.

Modify Home.vue to this:

Now, we will make our very first component. The navbar.

Goto src/components and create a new file Navbar.vue and put this here:

Note that applying max-height and max-width max-height="50" max-width="50" is important otherwise v-img will overflow and push the span to all the way in the right.

Then add this component to the Home.vue view like so:

Part-2 of this tutorial is here.




No Comments


You can leave the first : )



Leave a Reply

Your email address will not be published. Required fields are marked *