Project Creation:
vue create <project-name>: Creates a new Vue project using Vue CLI.
Development Server:
npm run serve: Compiles and hot-reloads the project for development.
npm run build: Compiles and minifies the project for production.
Vue CLI Service:
vue-cli-service serve: Starts the development server.
vue-cli-service build: Builds the project for production.
vue-cli-service inspect: Inspects the webpack config.
Project Maintenance:
npm install: Installs project dependencies based on the package.json file.
npm update: Updates project dependencies to their latest versions.
npm run lint: Lints and fixes files using ESLint.
npm run test: Runs unit tests.
Vue Component Generation:
vue generate <component-name>: Generates a new Vue component with a template, script, and style file.
vue generate <component-name> --functional: Generates a functional component.
vue generate <component-name> --no-styles: Generates a component without a separate style file.
Vue Router:
vue add router
npm install vue-router: Installs Vue Router in your project.
import { createRouter, createWebHistory } from 'vue-router': Importing Vue Router in your main.js file.
const router = createRouter({ ... }): Creating a router instance with routes and other configuration options.
router.push('/route-path'): Programmatically navigates to a specified route.
router-link: A component used to create links between routes in your templates.
VueX:
npm install vuex: Installs VueX in your project.
import { createStore } from 'vuex': Importing VueX in your main.js file.
const store = createStore({ ... }): Creating a store instance with state, mutations, actions, and getters.
store.commit('mutationName', payload): Commits a mutation to modify the state.
store.dispatch('actionName', payload): Dispatches an action to perform asynchronous operations.