Wayback Machine
158 captures
04 Jan 2019 - 27 Jun 2025
Jan FEB Mar
Previous capture 09 Next capture
2023 2024 2025
success
fail
About this capture
COLLECTED BY
Collection: Save Page Now
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20240209011439/https://code.visualstudio.com/docs/nodejs/vuejs-tutorial
Skip to content  Visual Studio Code
  • Docs
  • Updates
  • Blog
  • API
  • Extensions
  • FAQ
  • Learn
  • Search
  • Search Search
  • Download VS Code Download VS Code Download

Version 1.86 is now available! Read about the new features and fixes from January.

Dismiss this update
'; document.body.appendChild(div.children[0]); }
  • Overview
  • Setup
    • Overview
    • Linux
    • macOS
    • Windows
    • Raspberry Pi
    • Network
    • Additional Components
    • Enterprise
    • Uninstall
  • Get Started
    • Intro Videos
    • Tips and Tricks
    • User Interface
    • Themes
    • Settings
    • Key Bindings
    • Display Language
    • Telemetry
  • User Guide
    • Basic Editing
    • Extension Marketplace
    • IntelliSense
    • Code Navigation
    • Refactoring
    • Debugging
    • VS Code for the Web
    • Tasks
    • Profiles
    • Settings Sync
    • Snippets
    • Emmet
    • Command Line Interface
    • Workspace Trust
    • Multi-root Workspaces
    • Accessibility
    • Custom Layout
    • Port Forwarding
  • Source Control
    • Overview
    • Introduction to Git
    • Collaborate on GitHub
    • FAQ
  • Terminal
    • Terminal Basics
    • Terminal Profiles
    • Shell Integration
    • Appearance
    • Advanced
  • GitHub Copilot
    • Overview
    • Getting started
    • Copilot Chat tutorial
    • Prompt crafting
    • FAQ
  • Languages
    • Overview
    • JavaScript
    • JSON
    • HTML
    • CSS, SCSS and Less
    • TypeScript
    • Markdown
    • PowerShell
    • C++
    • Java
    • PHP
    • Python
    • Julia
    • R
    • Ruby
    • Rust
    • Go
    • T-SQL
    • C#
    • .NET
    • Polyglot
  • Node.js / JavaScript
    • Working with JavaScript
    • Node.js Tutorial
    • Node.js Debugging
    • Deploy Node.js Apps
    • Browser Debugging
    • Angular Tutorial
    • React Tutorial
    • Vue Tutorial
    • Debugging Recipes
    • Performance Profiling
    • Extensions
  • TypeScript
    • Tutorial
    • Compiling
    • Editing
    • Refactoring
    • Debugging
  • Python
    • Quick Start
    • Tutorial
    • Editing Code
    • Linting
    • Formatting
    • Debugging
    • Environments
    • Testing
    • Python Interactive
    • Django Tutorial
    • FastAPI Tutorial
    • Flask Tutorial
    • Create containers
    • Deploy Python Apps
    • Python in the Web
    • Settings Reference
  • Java
    • Getting Started
    • Navigate and Edit
    • Refactoring
    • Formatting and Linting
    • Project Management
    • Build Tools
    • Run and Debug
    • Testing
    • Spring Boot
    • Application Servers
    • Deploy Java Apps
    • GUI Applications
    • Extensions
    • FAQ
  • C++
    • Intro Videos
    • GCC on Linux
    • GCC on Windows
    • GCC on Windows Subsystem for Linux
    • Clang on macOS
    • Microsoft C++ on Windows
    • Build with CMake
    • CMake Tools on Linux
    • Editing
    • Debugging
    • Configure debugging
    • Settings
    • Configure IntelliSense
    • Configure IntelliSense for cross-compiling
    • FAQ
  • C#
    • Intro Videos
    • Get Started
    • Navigate and Edit
    • IntelliCode
    • Refactoring
    • Formatting and Linting
    • Project Management
    • Build Tools
    • Package Management
    • Run and Debug
    • Testing
    • FAQ
  • Docker
    • Overview
    • Node.js
    • Python
    • ASP.NET Core
    • Debug
    • Docker Compose
    • Registries
    • Deploy to Azure
    • Choose a dev environment
    • Customize
    • Develop with Kubernetes
    • Tips and Tricks
  • Data Science
    • Overview
    • Jupyter Notebooks
    • Data Science Tutorial
    • Python Interactive
    • PyTorch Support
    • Azure Machine Learning
    • Manage Jupyter Kernels
    • Jupyter Notebooks on the web
  • Azure
    • Extensions
    • Deployment
    • Remote Debugging for Node.js
    • Docker
    • MongoDB
    • Kubernetes
    • Azure Kubernetes Service
  • Remote
    • Overview
    • SSH
    • Dev Containers
    • Windows Subsystem for Linux
    • GitHub Codespaces
    • VS Code Server
    • Tunnels
    • SSH Tutorial
    • WSL Tutorial
    • Tips and Tricks
    • FAQ
  • Dev Containers
    • Overview
    • Tutorial
    • Attach to Container
    • Create a Dev Container
    • Advanced Containers
    • devcontainer.json
    • Dev Container CLI
    • Tips and Tricks
    • FAQ
Edit

Using Vue in Visual Studio Code

Vue.js is a popular JavaScript library for building web application user interfaces and Visual Studio Code has built-in support for the Vue.js building blocks of HTML, CSS, and JavaScript. For a richer Vue.js development environment, you can install the Volar and Volar for TypeScript extensions that support Vue.js IntelliSense, code snippets, formatting, and more.

Note: Vue 2 support will end on December 31st, 2023 so the use of the Vetur extension is not recommended. You will need to disable Vetur to use Volar.


welcome to Vue


Welcome to Vue

We'll be using the Vite tooling for this tutorial. If you are new to the Vue.js framework, you can find great documentation and tutorials on the vuejs.org website.

To install and use Vite and Vue.js, you'll need the Node.js JavaScript runtime and npm (the Node.js package manager) installed. npm is included with Node.js, which you can install from Node.js downloads.

Tip: To test that you have Node.js and npm correctly installed on your machine, you can type node --version and npm --version.

To get started, make sure you are in the parent directory where you intend to create a project. Then open your terminal or command prompt and type:

npm create vue@latest

You will be prompted to install create-vue.

Create vue

This may take a few minutes to install and execute create-vue, which helps you to scaffold your Vue project. Follow the prompts for optional features. You can choose "No" if you are unsure about an option.

Vue app scaffolding

Once the project is created, navigate into it and install dependencies. It may take a few minutes to install its dependencies.

cd <your-project-name>
npm install

Let's quickly run our Vue application by typing npm run dev to start the web server and open the application in a browser:

npm run dev

You should see "Welcome to your Vue.js App" on http://localhost:5173 in your browser. You can press Ctrl+C to stop the vue-cli-service server.

To open your Vue application in VS Code, from a terminal (or command prompt), navigate to the vue-project folder and type code .:

cd vue-project
code .

VS Code will launch and display your Vue application in the File Explorer.

Volar extension

Now expand the src folder and select the App.vue file. You'll notice that VS Code doesn't show any syntax highlighting and it treats the file as Plain Text as you can see in the lower right Status Bar. You'll also see a notification recommending the Volar extension for the .vue file type.

Volar extension recommendation

The Volar extension supplies Vue.js language features (syntax highlighting, IntelliSense, snippets, formatting) to VS Code.

Volar extension

From the notification, press Install to download and install the Volar extension. You should see the Volar extension Installing in the Extensions view. Once the installation is complete (may take several minutes), the Install button changes to the Manage gear button.

You should now see that .vue is a recognized file type for the Vue.js language and you have language features such as syntax highlighting, bracket matching, and hover descriptions.

Vue language features

IntelliSense

As you start typing in App.vue, you'll see smart suggestions or completions both for HTML and CSS but also for Vue.js specific items like declarations (v-bind, v-for) in the Vue template section:

Vue.js suggestions

and Vue properties such as computed in the scripts section:

Vue.js JavaScript suggestions

Go to Definition, Peek definition

VS Code through the Volar extension Vue.js language service can also provide type definition information in the editor through Go to Definition (F12) or Peek Definition (⌥F12 (Windows Alt+F12, Linux Ctrl+Shift+F10)). Put the cursor over the App, right-click and select Peek Definition. A Peek window opens showing the App definition from App.js.

Vue.js peek definition

Press Escape to close the Peek window.

Hello World

Let's update the sample application to "Hello World!". In App.vue replace the HelloWorld component msg custom attribute text with "Hello World!".

<template>
  <header>
    <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />

    <div class="wrapper">
      <HelloWorld msg="Hello World!" />
    </div>
  </header>

  <main>
    <TheWelcome />
  </main>
</template>

Once you save the App.vue file (⌘S (Windows, Linux Ctrl+S)), restart the server with npm run dev and you'll see "Hello World!". Leave the server running while we go on to learn about Vue.js client side debugging.

Tip: VS Code supports Auto Save, which by default saves your files after a delay. Check the Auto Save option in the File menu to turn on Auto Save or directly configure the files.autoSave user setting.


hello world


Linting

Linters analyze your source code and can warn you about potential problems before you run your application. The Vue ESLint plugin (eslint-plugin-vue) checks for Vue.js specific syntax errors, which are shown in the editor as red squiggles and are also displayed in the Problems panel (View > Problems ⇧⌘M (Windows, Linux Ctrl+Shift+M)).

Below you can see an error when the Vue linter detects more than one root element in a template:

Vue linting

Debugging

You can debug client side Vue.js code with the built-in JavaScript debugger. Follow this conversation to use Vite/Vue.js 3 project with VS Code using Microsoft Edge.

For Vue CLI, which is now in maintenance mode, check out Vue.js debugging in VS Code recipe on the VS Code debugging recipes site to learn more.

Another popular tool for debugging Vue.js is the vue-devtools plug-in, which can be used regardless of the environment.

Other extensions

Volar is only one of many Vue.js extensions available for VS Code. Another recommended extension is Volar for TypeScript.

Vue recommended extensions

You can search in the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)) by typing 'vue'.

Vue.js extensions

Extension like Vue VS Code Snippets can be handy for Vue snippets.

Vue VS Code Snippets

There are also Extension Packs, which bundle extensions that other people have found useful for Vue.js development.

Vue.js Extension Pack

02/1/2024

In this article there are 7 sectionsIn this article

  • Welcome to Vue
  • Volar extension
  • IntelliSense
  • Hello World
  • Linting
  • Debugging
  • Other extensions
  • Hello from Seattle.
  • Follow @code
  • Support
  • Privacy
  • Manage Cookies
  • Terms of Use
  • License
Microsoft homepage Microsoft homepage © 2024 Microsoft