Vue API interface management

Time:2021-9-21

Vue API encapsulation

When we use Vue cli to develop, we need to cooperate with back-end developers, so we need to encapsulate some components and use APIs

1. You can create the following directory under the SRC project to encapsulate all API interfaces there

Vue API interface management

2. Define the export function and the arrow function to export the corresponding interface business data method

Vue API interface management

3. Then use the following on the corresponding business order component

Vue API interface management

Vue API interface management

4 here you can use promise syntax then one by one

Vue API interface management

Vue API interface management


vue

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Lua language novice simple tutorial

1、 Foreword Lua is a lightweight and compact scripting language, which is written in standard C language and open in the form of source code. Its design purpose is to be embedded in the application, so as to provide flexible expansion and customization functions for the application. Lua can be applied in game development, independent […]