YouTip LogoYouTip

Vue3 Vscode

Visual Studio Code (referred to as VS Code) is a free, open-source code editor developed by Microsoft. It supports multiple programming languages and provides features like syntax highlighting, intelligent code completion, code refactoring, and debugging. Visual Studio Code has built-in support for Vue.js's core building blocks: HTML, CSS, and JavaScript. VS Code includes a built-in terminal, allowing you to run command-line tools like npm and yarn directly within the editor, facilitating project building and management. If you desire a richer Vue.js development environment, you can install the Volar and Volar for TypeScript extensions. These extensions provide intelligent hints for Vue.js. > If you are not familiar with VS Code or haven't installed it yet, you can refer to: (#). * * * ## Create a Vue Project Open a terminal or command prompt and enter the following command: npm create vue@latest You will be prompted to enter a project name. Here, we enter -vue3-app: Vue.js - The Progressive JavaScript Framework? Please enter the project name: β€Ί -vue3-app Afterwards, there will be some options. You can choose according to your needs, or just press Enter through them: Vue.js - The Progressive JavaScript Framework> Please enter the project name: … -vue3-app > Do you want to use TypeScript syntax? … No / is> Do you want to enable JSX support? … No / is> Do you want to introduce Vue Router for single-page application development? … No / is> Do you want to introduce Pinia for state management? … No / is> Do you want to introduce Vitest for unit testing? … No / is> Do you want to introduce an end-to-end (E2E) testing tool? β€Ί Not needed> Do you want to introduce ESLint for code quality checking? β€Ί Is the project being initialized? /Users/tianqixin/-vue3-app...Project initialization complete, you can execute the following command: cd -vue3-app npm install npm run dev After the project is created, navigate into the project folder and install the dependencies: cd -vue3-app npm install Installing dependencies might also take a few minutes. Enter the following command to quickly start your Vue application: npm run dev !(#) Open http://localhost:5173 in your browser, and it will display as follows: !(#) Press Ctrl+C to stop the vue-cli-service server. * * * ## Open the Vue Project in VS Code From the terminal or command prompt, navigate into the Vue project folder we created, -vue3-app, and then use the `code` command to open the project in VS Code: cd -vue3-app code . VS Code will launch and display your Vue project in the File Explorer, as shown below: !(#) Next, expand the src folder and select the App.vue file. The status bar at the bottom right will also prompt you to install the Vue - Official extension to support .vue files: !(#) Choose to install it. After installation, .vue files are recognized as the Vue.js file type and support the following language features: * **Syntax Highlighting** * **Bracket Matching** * **Hover Descriptions** !(#) ### Intelligent Hints (IntelliSense) While typing code in App.vue, you will see intelligent hints for HTML, CSS, and Vue.js-specific syntax (like v-bind, v-for). !(#) In the script section, you can also see hints for Vue.js-related JavaScript features, such as computed properties. ### Go to Definition, Peek Definition With the installed Volar extension, VS Code supports the Vue.js language service. Place the cursor on 'App', right-click and select 'Peek Definition' to view the definition information, or press the shortcut key βŒ₯F12 (Option+F12 on Mac, Alt+F12 on Windows). You will see a pop-up window showing the definition information for App. !(#) Press the Esc key to close the peek window. ### Modify and Run "Hello World" In App.vue, replace the text of the msg custom attribute in the HelloWorld component with "Hello World!": ## Example
Save the App.vue file (shortcut ⌘S or Ctrl+S), and then restart the server with the following command: npm run dev In your browser, you will see the page displaying "Hello World!". !(#) * * * ## More Related Tools AI Development Environment Online AI Application Generation and Development Platform
← Vscode Shortcut KeysVscode Extensions β†’