Part of the summary of vue.js

1.MVVM and the difference between MVC: 
MVVM: is Model-View-ViewModel shorthand, namely Model - View - ViewModel
model: the back-end data transfer
attempt: see page
view model: Core mvvm mode, it is and a model of a bridge view.
Achieve two directions:
1) Model === "view: the rear end of the data transfer page is converted to be seen, implementation (Binding data)
2) === view" Model: see upcoming conversion page into the rear end of the data, the manner (DOM event listener)
MVC: MVC is the model-view-controller shorthand, i.e. model - view - controller
controller refers to a page service logic, the aim is to use the MVC M and V code-

using MVVM pattern has several advantages:
  1) low coupling. View Model can be independent of changes and modifications can be bound to a ViewModel different View, when the Model View can change the same, when the Model View can also change the time constant.
  2). Reusability. You can put some logic in view of the ViewModel inside, so many View reuse this view logic.
  3). Independent development. Developers can focus on developing business logic and data (ViewModel). Designers can focus on the interface (View) design.
  4). Testability. You can test the interface (View) for the ViewModel

2.vue life cycle
Eight: Before creating, after creation, before loading, after loading, before the update after update, before the destruction, the destruction of
the role of the life cycle: make it easier to form good logic in the control of the entire process Vue instance
DOM rendering after loading (mounted) in has been completed.

3.vue two-way binding principle
vue implement two-way data binding mainly: the use of data in conjunction with hijacking a publisher - way mode subscribers by Object.defineProperty ()
to hijack setter of each property, getter, released at the time of data changes messages to subscribers, triggering the appropriate listener callback.

Passing parameters between 4.Vue assembly
1) subassembly parent component by value
parent === "child: receiving data sub-assembly method props;
child ===" Parent: $ subassembly passes parameters EMIT method, triggering the parent event component
2) data transfer between the components non Sons, brothers pass component value
EventBus, the center is to create an event, corresponding to the relay station, it can be used to transfer events and receive events
larger VUEX item

difference React with the 5.Vue



6.vue routing hook function
Home can control the navigation jump, beforeEach, afterEach, are generally used to modify the title of the page.
Some need to be logged in to adjust the redirection page.
beforeEach There are three parameters to, from, the Next
to: the target is about to enter the route object route
from: route was about to leave the current navigation route
next: function must call the method resolve this hook. Implementation of the results depend on the method call parameters next. You can control the jump pages.
Global navigation hook:
router.beforeEach (to, from, Next),
router.beforeResolve (to, from, Next),
router.afterEach (to, from, Next)
within the component hook:
beforeRouteEnter,
beforeRouteUpdate,
beforeRouteLeave
individual components exclusive route :
beforeEnter


7.vuex what is? how to use? Which Scenario to use it?
Reads only in a state focused on the store; change of state is the way to submit mutations, which is sync thing; asynchronous logic should be encapsulated in the action.
Store introduced in main.js, injection. Create a directory store, ... .. export.
Scene: single-page application, the state between components, music player, logged, Add to Cart

What characteristic mutation and action of vuex is? What's the difference?
mutation for modifying state data is synchronized.
action similar muation, except that: action is submitted mutation, rather than directly changing the state of
action can include any asynchronous operation

8.css current component acting only
written in style to scoped tags: <style scoped> </ style>

9.v-v-show the difference between iF and
v-if rendered in accordance with whether the condition, or v-show block is none display the
values of v-show whether true or false, and the elements are present in the html code, but only when the v-if the value is true, the presence of only the HTML element
v-show style instruction only sets the value of the element css

10. the Router $ $ route and the difference between
$ route is "routing information object", including path, params, hash, query, fullPath, matched, name and other routing information parameter
$ router is a "routing instance" object includes a jump method of routing, hook function, etc.

What are the two core 11.vue.js is? vue several commonly used commands?
A data driver, the components of system
commands: for-V, V-IF, the bind-V, ON-V, V-Show, the else V-

12.vue conventional modifier?
prevent: an event not to reload the page
stop: stop the event from bubbling
self: when an event occurs when the element itself, rather than the child element will trigger
capture: an event listener, when the incident calls

13. keep-alive understanding of
keep-alive Vue is a built-in component, the component can be included on hold, or to avoid re-rendering.
Add the keep-alive two attributes: include (cache component included) and exclude (not exclude assembly cache, a priority greater than the include)

<= the include keep-alive 'include_components' = the exclude 'exclude_components'>
<Component>
<! - depending on whether the component is cached attributes include and exclude ->
</ component>
</ Keep-Alive>
of parameters:
include - a string or a regular expression, only the matching component name will be cached
exclude - or string regular expressions, any matching component names will not be cached
include and exclude attributes allows components to conditionally cache. Both can be "," to separate strings, regular expressions, arrays. When using regular or an array, remember to use the v-bind.

13.vue. What js that?
Construction of a progressive frame is a user interface. Other heavyweight frame is different, Vue incremental development bottom-up design.
Vue core library focus only on the view layer, and very easy to learn, easy to integrate with other libraries or existing project. on the other hand,
Vue is fully capable of driving the use of complex single-page single-file application components and Vue ecosystem support library development.
Vue.js target binding component data and is a view of the combined response implemented as simple as possible by the API

14.vue.js characteristics of
the MVVM, component-based, command system, supports virtual DOM
virtual dom: Virtual Object is represented DOM a node, this is called VNode Object, and then use two VNode comparison, real DOM modification according to the results of the comparison.
It is generated each time a new rendering VNode, and then the vnode when compared with a render. Then a new generation of these VNode the buffer used for comparison at once.
The disadvantage of virtual dom:
1. Code more, bulkier
2. increased memory footprint
single dom 3. Use a small amount of modification costs but higher virtual dom, dom than directly modify real fast

15.vue.js features
description: data page from a template + Json + Vue composition examples HTML
data driver: calculated automatically tracing attributes and template-dependent expression of
components of: a reusable, decoupling assembly constructed page
lightweight: a small amount of code, not dependent other libraries
fast: DOM accurate and efficient batch update
through a variety of ways npm, bower and other installation, easy to integrate into: template-friendly

Why write when 16.Vue project in the component key, what its role is?
in the development process, we the need to ensure an element of key unique in its sibling elements.
In the Diff algorithm will come to judge the value of the element by means of Key element is the element from being moved or newly created,
thereby reducing unnecessary re-rendering elements.

The difference 17.computed and watched:
computed attribute is calculated, the calculated values depend on other attributes, and the computed values are cached content will return only if the calculated value changes.
watch will listening to a callback change values, logical operations may be performed in a number of callback.


What 18.axios that? how to use? It describes the use of the process to achieve login feature?
Module backstage resource requests. npm install axios -S installed, then the cross-domain transmission, need to be provided in the configuration file config / index.js.
If the background is Tp5 defines a resource routing. js used import in, then .get or .post. .Then function returns if successful,
failure is a function in .catch

Guess you like

Origin www.cnblogs.com/52cyd/p/11228019.html