wz-uniapp/docs/Task2.md

19 lines
503 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@App.vue里链接一些工具 类似
```
import Request from "@/common/request";
const request = new Request();
export default {
Tool:{
Request: request,
},
}
```
这样之后在其他页面,只需要调用
```
const app = getApp()
app.Tool.Request.get(...)
```
是不是就可以用了?你看一下可行性,可以的话把目前的 Rquest这样试试一下再加一个 接口地址的静态变量工具,避免接口地址在代码里分散管理,需要做集中管理。