Vue.js: Difference between revisions

Content deleted Content added
Ajtruex (talk | contribs)
No edit summary
Ajtruex (talk | contribs)
No edit summary
Line 14:
}}
 
'''Vue.js''' (commonly referred to as '''Vue'''; pronounced {{IPA|{{IPAc-en|v|j|uː}}}}, like '''view''') is an [[Open-source software|open-source]] progressive [[JavaScript framework]] for building [[user interfaces]].<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/#What-is-Vue-js|title=Introduction — Vue.js|access-date=2017-03-11|language=en}}</ref> Integration into projects that use other [[JavaScript library|JavaScript libraries]] is made easy with Vue because it is designed to be incrementally adoptable. Also, Vue is a capable [[Web application frameworks|web application framework]] that is able to power advanced [[Single-page application|single-page applications]].
 
According to a 2016 [http://stateofjs.com/ JavaScript survey], Vue has an 89% developer satisfaction rating. Vue accumulates around 80 [[GitHub|Github]] stars per day,<ref>{{Cite newsweb|url=http://stateofjs.com/2016/frontend/|title=State Of JavaScript Survey Results: Front-end Frameworks|access-date=2017-03-11|language=en}}</ref><ref>{{Cite web|url=http://bestof.js.org/tags/framework/trending/last-12-months|title=Trending JavaScript Frameworks|last=|first=|date=|website=|archive-url=|archive-date=|dead-url=|access-date=2017-03-11}}</ref> and is the 14th most starred project on Github of all time.<ref>{{Cite web|url=https://github.com/search?p=2&q=stars%3A%3E1&s=stars&type=Repositories|title=Most Starred Repositories|last=|first=|date=|website=GitHub|archive-url=|archive-date=|dead-url=|access-date=2017-03-11}}</ref>
 
== Overview ==
Line 23:
The project focuses on making some of the best ideas in web UI development (components, declarative UI, hot-reloading, time-travel debugging, etc.) more approachable, so that any developer can quickly pick it up and enjoy the productivity boost when working with modern, interactive web interfaces.
 
It is also designed to be progressively adoptable: Vue.js core is a drop-in library that can be used in existing pages, you can use it to add simple interactivity, or to replace [[jQuery]] entirely. On the other hand, the project also includes libraries and tools that supports building large and ambitious single page applications.<ref>{{Cite newsweb|url=https://www.patreon.com/evanyou|title=Evan is creating Vue.js {{!}} Patreon|work=Patreon|access-date=2017-03-11|language=en}}</ref>
 
== History ==
Line 40:
Vue uses an [[HTML]]-based template syntax that allows you to declaratively bind the rendered [[Document Object Model|DOM]] to the underlying Vue instance’s data. All Vue templates are valid HTML that can be parsed by spec-compliant browsers and [[HTML parser|HTML parsers]]. Under the hood, Vue compiles the templates into Virtual DOM render functions. Combined with the reactivity system, Vue is able to intelligently figure out the minimal amount of components to re-render and apply the minimal amount of DOM manipulations when the app state changes.
 
In Vue, you can use the template syntax or choose to directly write render functions using [[JSX (JavaScript)|JSX]]. In order to do so just replace the template option with a render function.<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/syntax.html|title=Template Syntax — Vue.js|access-date=2017-03-11|language=en}}</ref> Render functions open up possibilities for powerful component-based patterns — for example, the new transition system is now completely component-based, using render functions internally.<ref>{{Cite web|url=https://medium.com/the-vue-point/vue-2-0-is-here-ef1f26acf4b8#77d9|title=Vue 2.0 is Here!|last=|first=|date=2016-09-30|website=The Vue Point|archive-url=|archive-date=|dead-url=|access-date=2017-03-11}}</ref>
 
=== Reactivity ===
One of Vue’s most distinct features is the unobtrusive reactivity system. Models are just plain [[JavaScript]] objects. When you modify them, the view updates. It makes state management very simple and intuitive. Vue provides optimized re-rendering out of the box without you having to do anything. 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.<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/reactivity.html|title=Reactivity in Depth — Vue.js|access-date=2017-03-11|language=en}}</ref>
 
=== Components ===
Components are one of the most powerful features of Vue. In a large application, it is necessary to divide the whole app into small, self-contained, and often reusable components to make development manageable. Components extend basic [[HTML element|HTML elements]] to encapsulate reusable code. At a high level, components are custom elements that Vue’s compiler attaches behavior to. In Vue, a component is essentially a Vue instance with pre-defined options.<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/components.html|title=Components — Vue.js|access-date=2017-03-11|language=en}}</ref>
 
=== Transitions ===
Line 58:
# 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.
# 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.<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/transitions.html|title=Transition Effects — Vue.js|access-date=2017-03-11|language=en}}</ref><ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/transitioning-state.html|title=Transitioning State — Vue.js|access-date=2017-03-11|language=en}}</ref>
 
=== Routing ===
Vue itself doesn’t come with [[routing]]. But there’s the vue[https://github.com/vuejs/vue-router -]router package to help you out. It supports mapping nested routes to nested components and offers fine-grained transition control. Creating a Single-page Application with Vue + vue-router is dead simple. With Vue, we are already composing our application with components. When adding vue-router to the mix, all we need to do is map our components to the routes and let vue-router know where to render them.<ref>{{Cite newsweb|url=https://vuejs.org/v2/guide/routing.html|title=Routing — Vue.js|access-date=2017-03-11|language=en}}</ref>
 
== Comparison with Other Frameworks ==