The basic types of vue are: 1. String type, which is a piece of text wrapped in single or double quotes; 2. Boolean type, which has only two values: true and false ;3. Number type, used to define numerical values without distinguishing between integers and decimals.
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
In vue, data types are divided into two types: basic types and non-basic types (reference types).
Basic types are also called value types. String, Boolean and Number are all primitive types.
The string (String) type is a piece of text wrapped in single quotes '' or double quotes ""
Number (Number) The type is used to define numerical values, without distinguishing between integers and decimals (floating point numbers). The Number type is used uniformly to represent
The Boolean type has only two values, true (true) or false ( False), which is often used when making conditional judgments. In addition to directly using true or false to define Boolean type variables, you can also use some expressions to get Boolean type values
Non-basic types can also be understood as reference types. Arrays and objects are both reference types.
Basic type
Variables of primitive type/value type directly store data.
Reference type
The value stored in the reference type (reference type) is a reference (reference) pointing to the data, not the data itself.
This is also why there is
in the official vue documentation. #Don't use non-primitive values like objects and arrays as v-for keys. Use string or numeric values instead.
Do not use non-basic type values such as objects or arrays as the key of v-for. Please use a string or numeric value.
The reason for this statement.
Screenshots from https://vuejs.org/v2/guide/list.html#Maintaining-State
(Learning video sharing: vuejs tutorial, web front-end)
The above is the detailed content of What are the basic types of vue?. For more information, please follow other related articles on the PHP Chinese website!