Vue / Vuex project setup

We will use Vue CLI.

Start by installing the CLI globally on your machine.

Open your terminal and run:

npm install -g @vue/cli

When it’s done, select your root project space and create your project:

Image for post

Terminal

vue create my-project

The CLI will ask you to pick a preset of your choice and here, just make sure that Vuex is selected.

On macOS, navigate with your keyboard “up” and “down” arrows and select with the spacebar.

Image for post

Terminal

After a short moment, your project is created. Then run:

cd my-project
npm run serve

Your project tree should look like this:

Image for post

Project tree

Finally, remove the CLI dummy content until you see a blank page.

Vuex store setup

Now let’s focus on the store!

As a reminder, your store is registered globally inside main.js.

#javascript #web-development #vuejs #vuex

Simple Vuex Modules Starter With Real Data
1.10 GEEK