Home  >  Article  >  Web Front-end  >  What are the basic types of vue?

What are the basic types of vue?

青灯夜游
青灯夜游Original
2022-03-07 13:51:2810890browse

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.

What are the basic types of vue?

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.

Difference

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.
What are the basic types of vue?

Screenshots from https://vuejs.org/v2/guide/list.html#Maintaining-State

What are the basic types of vue?

(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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn