Home Web Front-end Front-end Q&A Is vuejs an API?

Is vuejs an API?

Sep 27, 2021 pm 07:15 PM
api vuejs

vuejs is not an API. vuejs is a progressive JavaScript framework for building user interfaces, designed to better organize and simplify web development. API refers to application programming interface, which is a set of predefined functions that provide applications and developers with the ability to access a set of routines based on certain software or hardware.

Is vuejs an API?

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

vuejs is not an API.

Vue (pronounced /vjuː/, similar to view) is a progressive JavaScript framework for building user interfaces, aiming to better organize and simplify web development. Unlike other large frameworks, Vue is designed to be applied layer by layer from the bottom up.

Vue’s core library only focuses on the view layer, which is not only easy to get started, but also easy to integrate with third-party libraries or existing projects. On the other hand, when combined with a modern tool chain and various supporting libraries, Vue is also fully capable of providing drivers for complex single-page applications (SPA).

Vue.js also provides MVVM data binding and a composable component system, with a simple and flexible API. Its goal is to achieve responsive data binding and composability through the simplest possible API. view component.

And API (Application Programming Interface, Application Programming Interface) are some predefined functions, the purpose is to provide applications and developers with access to a set of routines based on certain software or hardware capabilities without having to access the source code or understand the details of the inner workings.

Some APIs in vuejs

vm refers to the instance obtained by new Vue

(1) When the dom tag in After the value is bound to the value in data, changing the value corresponding to data can update the value in the tag in real time;

but the value added subsequently is invalid (binding fails).

(2) The object can be directly used as an attribute of data, which is valid (because the object is passed by value);

So the attribute and the object are congruent;

(3) The interfaces of vm are:

vm.$data is the data attribute of vm;

vm.$el is the dom node pointed to by the el attribute;

vm.$watch is to monitor attribute changes (such as the value in data) (refer to (9))

(4) The declaration cycle of the vue instance, there are several key functions:

created: After the event binding is completed, the function is directly used as an attribute in the vue instance when declaring the vue instance, the same below.

vm.$mount: Mount the dom node;

beforeCompile: before loading the template;

compiled: after loading the template;

ready: completed After (I guess);

beforeDestroy: before destruction;

destroyed: after destruction;

(5) vm.$mount (mounted id or class name )

When adding a new Vue instance, if you do not add el, it means that it will not be mounted and will only be generated. After generation, you can use this method to manually mount it to a certain place. If there are multiple ones that meet the conditions, Then mount it to the first place;

(6) v-for traverses arrays and objects, and can create multiple tags; for example, it is used to create tables;

(7) Escape: {{}} Two curly brackets will not escape the html tag of the value;

{{{}}} Three curly brackets will escape the html tag of the value and turn it into html text;

You cannot put bound data in the value (unless you use partials, but I don’t know how yet);

(8) Within the braces of interpolation, you can put expressions ( Functions cannot be placed);

(9) Within the curly brackets of interpolation, add the pipe symbol |, and you can use filters;

capitalize is a filter that capitalizes the first letter;

The filter can only be placed at the end of the expression and cannot be part of the expression;

The filter can add parameters;

The filter can be customized (but we don’t know how to customize it yet. defined method);

(10) Instruction:

v-if="variable name" Exists when a value is true;

v-bind: attribute Name = "Variable name" Bind the variable name after the equal sign (pointing to the attribute with the same name in the data attribute of vm) to the html attribute of the tag.

v-on: event type = "function name" When the event type is triggered, the function in methods is executed;

The abbreviation of v-on is @; the abbreviation of v-bind is: ( Colon);

(11) Computed attribute computed

The attribute here can be used as the data attribute; the advantage is that when the value in data changes, it will change together;

You can use more complex expressions (only simple expressions can be used in interpolation);

(12) Setters and getters of calculated properties

The default is getter (get attribute of the object), that is, when a certain value changes, the callback function (or get method) is triggered;

When the calculated property changes, certain values ​​need to be changed (such as changing 10 values, it is not good to write monitoring this value elsewhere), then you need to set the setter (set attribute of the object), that is, when the calculated attribute changes, the set method is triggered;

(13) Monitoring attributes vm.$watch (monitored attribute, callback function)

What is monitored is the data attribute;

The first parameter of the callback function is the changed value, and the second parameter is the changed value The previous value;

Triggered when the value of the attribute changes;

(14) class binding:

Use v-bind:class

Class use In object form, the key is the class name, and the value indicates whether to display this class;

You can directly place an object object in the value of v-bind:class, and place this object in the data attribute. Just set the properties of this object object in this way;

Class array writing method: the members in the array are variable names. If the variable is not an object object, the value of the variable is the class name; if it is an object, the object The key is the class name, and the value indicates whether to display;

(15) style binding:

Use v-bind:style

The form is an object, the key of the object Is the style name (such as fontSize, note that the style name needs to be in camel case instead of css), and the value is the value of the style;

You can directly put the object name on the right side of the equation of v-bind:style;

Changes in the value of the object will affect the inline style in real time;

For some styles, you can add prefixes for the browser (but some are not compatible with all browsers);

Related recommendations: "vue.js Tutorial"

The above is the detailed content of Is vuejs an API?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to crawl and process data by calling API interface in PHP project? How to crawl and process data by calling API interface in PHP project? Sep 05, 2023 am 08:41 AM

How to crawl and process data by calling API interface in PHP project? 1. Introduction In PHP projects, we often need to crawl data from other websites and process these data. Many websites provide API interfaces, and we can obtain data by calling these interfaces. This article will introduce how to use PHP to call the API interface to crawl and process data. 2. Obtain the URL and parameters of the API interface. Before starting, we need to obtain the URL of the target API interface and the required parameters.

How to use Vue to implement QQ-like chat bubble effects How to use Vue to implement QQ-like chat bubble effects Sep 20, 2023 pm 02:27 PM

How to use Vue to implement QQ-like chat bubble effects In today’s social era, the chat function has become one of the core functions of mobile applications and web applications. One of the most common elements in the chat interface is the chat bubble, which can clearly distinguish the sender's and receiver's messages, effectively improving the readability of the message. This article will introduce how to use Vue to implement QQ-like chat bubble effects and provide specific code examples. First, we need to create a Vue component to represent the chat bubble. The component consists of two main parts

How to use PHP and Vue.js to implement data filtering and sorting functions on charts How to use PHP and Vue.js to implement data filtering and sorting functions on charts Aug 27, 2023 am 11:51 AM

How to use PHP and Vue.js to implement data filtering and sorting functions on charts. In web development, charts are a very common way of displaying data. Using PHP and Vue.js, you can easily implement data filtering and sorting functions on charts, allowing users to customize the viewing of data on charts, improving data visualization and user experience. First, we need to prepare a set of data for the chart to use. Suppose we have a data table that contains three columns: name, age, and grades. The data is as follows: Name, Age, Grades Zhang San 1890 Li

Oracle API Usage Guide: Exploring Data Interface Technology Oracle API Usage Guide: Exploring Data Interface Technology Mar 07, 2024 am 11:12 AM

Oracle is a world-renowned database management system provider, and its API (Application Programming Interface) is a powerful tool that helps developers easily interact and integrate with Oracle databases. In this article, we will delve into the Oracle API usage guide, show readers how to utilize data interface technology during the development process, and provide specific code examples. 1.Oracle

How to deal with Laravel API error problems How to deal with Laravel API error problems Mar 06, 2024 pm 05:18 PM

Title: How to deal with Laravel API error problems, specific code examples are needed. When developing Laravel, API errors are often encountered. These errors may come from various reasons such as program code logic errors, database query problems, or external API request failures. How to handle these error reports is a key issue. This article will use specific code examples to demonstrate how to effectively handle Laravel API error reports. 1. Error handling in Laravel

Oracle API integration strategy analysis: achieving seamless communication between systems Oracle API integration strategy analysis: achieving seamless communication between systems Mar 07, 2024 pm 10:09 PM

OracleAPI integration strategy analysis: To achieve seamless communication between systems, specific code examples are required. In today's digital era, internal enterprise systems need to communicate with each other and share data, and OracleAPI is one of the important tools to help achieve seamless communication between systems. This article will start with the basic concepts and principles of OracleAPI, explore API integration strategies, and finally give specific code examples to help readers better understand and apply OracleAPI. 1. Basic Oracle API

React API Call Guide: How to interact and transfer data with the backend API React API Call Guide: How to interact and transfer data with the backend API Sep 26, 2023 am 10:19 AM

ReactAPI Call Guide: How to interact with and transfer data to the backend API Overview: In modern web development, interacting with and transferring data to the backend API is a common need. React, as a popular front-end framework, provides some powerful tools and features to simplify this process. This article will introduce how to use React to call the backend API, including basic GET and POST requests, and provide specific code examples. Install the required dependencies: First, make sure Axi is installed in the project

Development suggestions: How to use the ThinkPHP framework for API development Development suggestions: How to use the ThinkPHP framework for API development Nov 22, 2023 pm 05:18 PM

Development suggestions: How to use the ThinkPHP framework for API development. With the continuous development of the Internet, the importance of API (Application Programming Interface) has become increasingly prominent. API is a bridge for communication between different applications. It can realize data sharing, function calling and other operations, and provides developers with a relatively simple and fast development method. As an excellent PHP development framework, the ThinkPHP framework is efficient, scalable and easy to use.

See all articles