Learn VUE-JS with Real Code Examples
Updated Nov 21, 2025
Installation Setup
Install via CDN for simple projects
Install via npm: `npm install vue`
Use Vue CLI: `npm install -g @vue/cli`
Create project with `vue create project-name`
Integrate with build tools like Vite or Webpack
Environment Setup
Install Node.js and npm
Install Vue CLI globally: `npm install -g @vue/cli`
Optionally install Vite for faster builds
Set up IDE plugins (VSCode: Vetur, Volar)
Verify installation with `vue --version`
Config Files
package.json - project dependencies
vite.config.js / vue.config.js - build configuration
main.js / main.ts - entry point
App.vue - root component
components/ - reusable components folder
Cli Commands
vue create project-name - scaffold new project
npm run serve - start development server
npm run build - production build
npm run lint - run linter
npm run test - run tests
Internationalization
Use vue-i18n plugin for translations
Store messages in JSON/YAML
Switch locales dynamically
Support RTL and LTR languages
Format dates, numbers, and currencies per locale
Accessibility
Use ARIA attributes in templates
Ensure keyboard navigation
Use semantic HTML elements
Test with screen readers
Follow WCAG guidelines
Ui Styling
Scoped CSS in `.vue` files
CSS Modules or Tailwind CSS
Dynamic classes with `:class` binding
Inline styles via `:style` binding
Transition and animation with `transition` component
State Management
Vuex: centralized state for large apps
Pinia: modern, modular state management
Reactive data inside components for local state
Props and events for parent-child communication
Provide/Inject API for dependency injection
Data Management
Reactive data via `ref()` and `reactive()`
Computed properties and watchers
Persist state in localStorage or IndexedDB
Fetch and manage API data with Axios
Use plugins for advanced data handling