Vus Js

Posted on  by admin

Applies to: Visual Studio Visual Studio for Mac

In this 5-10 minute introduction to the Visual Studio integrated development environment (IDE), you'll create and run a simple Vue.js web application.

(Redirected from Evan You).

Vue.js (commonly referred to as Vue; pronounced "view"[4]) is an open-sourcemodel–view–viewmodelfront endJavaScript framework for building user interfaces and single-page applications.[10] It was created by Evan You, and is maintained by him and the rest of the active core team members.[11].


  • Vue.js features an incrementally adaptable architecture that focuses on declarative rendering and component composition.

    The core library is focused on the view layer only.[4] Advanced features required for complex applications such as routing, state management and build tooling are offered via officially maintained supporting libraries and packages.[12].

    Vue.js allows for extending HTML with HTML attributes called directives.[13] The directives offer functionality to HTML applications, and come as either built-in or user defined directives.

    Vue was created by Evan You after working for Google using AngularJS in several projects. He later summed up his thought process: "I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight."

  • [14] The first source code commit to the project was dated July 2013, and Vue was first released the following February, in 2014.

    Version names are often derived from manga and anime, most of which are within the science fiction genre. When a new major is released ie v3.y.z, the last minor ie 2.x.y will become a LTS release for 18 months (bug fixes and security patches) and for the following 18 months will be in maintenance mode (security patches only).[33].

    Vue components extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements to which the Vue's compiler attaches behavior. In Vue, a component is essentially a Vue instance with pre-defined options.[34]The code snippet below contains an example of a Vue component. The component presents a button and prints the number of times the button is clicked:.

Create a project

First, you'll create a Vue.js web application project.

  1. Vue uses an HTML-based template syntax that allows binding the rendered DOM to the underlying Vue instance's data.

    All Vue templates are valid HTML that can be parsed by specification-compliant browsers and HTML parsers.

  2. Vue compiles the templates into virtual DOM render functions.

  3. A virtual Document Object Model (or "DOM") allows Vue to render components in its memory before updating the browser.

    Combined with the reactivity system, Vue can calculate the minimal number of components to re-render and apply the minimal amount of DOM manipulations when the app state changes. Vue users can use template syntax or choose to directly write render functions using hyperscript either through function calls or JSX.[35] Render functions allow applications to be built from software components.[36].

    Vue features a reactivity system that uses plain JavaScript objects and optimized re-rendering. Each component keeps track of its reactive dependencies during its render, so the system knows precisely when to re-render, and which components to re-render.[37].

    Vue provides a variety of ways to apply transition effects when items are inserted, updated, or removed from the DOM. This includes tools to:.

    Automatically apply classes for CSS transitions and animations. Integrate third-party CSS animation libraries, such as Animate.css.

  4. Use JavaScript to directly manipulate the DOM during transition hooks. Integrate third-party JavaScript animation libraries, such as Velocity.js.

  5. When an element wrapped in a transition component is inserted or removed, this is what happens:.

    Vue will automatically sniff whether the target element has CSS transitions or animations applied. If it does, CSS transition classes will be added/removed at appropriate timings.

Explore the IDE

  1. If the transition component provided JavaScript hooks, these hooks will be called at appropriate timings.

    • If no CSS transitions/animations are detected and no JavaScript hooks are provided, the DOM operations for insertion and/or removal will be executed immediately on next frame.[38][39].

    • A traditional disadvantage of single-page applications (SPAs) is the inability to share links to the exact "sub" page within a specific web page.

    • Because SPAs serve their users only one URL-based response from the server (it typically serves index.html or index.vue), bookmarking certain screens or sharing links to specific sections is normally difficult if not impossible.

  2. To solve this problem, many client-side routers delimit their dynamic URLs with a "hashbang" (#!), e.g. However, with HTML5 most modern browsers support routing without hashbangs.

Add a .vue file to the project

  1. Vue provides an interface to change what is displayed on the page based on the current URL path – regardless of how it was changed (whether by emailed link, refresh, or in-page links).

  2. Additionally, using a front-end router allows for the intentional transition of the browser path when certain browser events (i.e.

    clicks) occur on buttons or links. Vue itself doesn't come with front-end hashed routing.

Build the project

  1. But the open-source "vue-router" package provides an API to update the application's URL, supports the back button (navigating history), and email password resets or email verification links with authentication URL parameters.

  2. It supports mapping nested routes to nested components and offers fine-grained transition control.

  1. With Vue, developers are already composing applications with small building blocks building larger components.

  2. With vue-router added to the mix, components must merely be mapped to the routes they belong to, and parent/root routes must indicate where children should render.[40].

  3. The code above:. Sets a front-end route at

The JavaScript Vue.js project template (and older versions of the TypeScript template) use the build npm script by configuring a post build event. If you want to modify this setting, open the project file (.njsproj) from Windows Explorer and locate this line of code:

Run the application

  1. Which will render in the User component defined in (const User..).

    Allows the User component to pass in the particular id of the user which was typed into the URL using the $route object's params key: $

    This template (varying by the params passed into the router) will be rendered into inside the DOM's div#app.

    The finally generated HTML for someone typing in: will be:.

  2. The core library comes with tools and libraries both developed by the core team and contributors.

Congratulations on completing this Quickstart! We hope you learned a little bit about using the Visual Studio IDE with Vue.js. If you'd like to delve deeper into its capabilities, continue with a tutorial in the Tutorials section of the table of contents.

Next steps