What is vue?
It is based on the mvvm framework and is similar to angular. It is relatively small and easy to use.
vue official website:
vue manual website:
If you can angular, it’s great It’s easy to learn vue. Because they are basically similar
The vue command is v-xxx. Vue is composed of a piece of html code combined with json, and a new vue instance is created. Vue is developed by individuals and maintained by individuals.
vue Because of its small size, it is more suitable for mobile terminals. It is also not compatible with lower versions of IE like angular
. To use it, you must first go to the vue official website to download its library file.
Basic usage of vue:
Common instructions:
Angular has ng-model to get form element data vue gets form element data as v-model It can also perform two-way data binding with Angular.
There is ng-repeat in angular to loop the array json object. Vue is different. It uses v-for=' val in arr'. Of course, the usage is still the same just by changing the name.
The vue loop also comes with each subscript of {{$index}}. It also brings a {{$key}} which can display the key name of json
vue event:
Angular has events, of course Vue also has them. There is a difference here. Angular is ng-click. Vue is v-on:click=" fn()"
v- show:
There is ng-show="true/false" in angular vue is the same as v-show="true/false" Same true shows false hide
//前边说了需要一片html代码来实现这就是我们那一片代码
The above is the detailed content of Basic use of vue. For more information, please follow other related articles on the PHP Chinese website!