faeat:fastapi本地网络请求调试
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { View, Text, Image } from "@tarojs/components";
|
import { View, Text, Image } from "@tarojs/components";
|
||||||
import { useLoad } from "@tarojs/taro";
|
import { useLoad } from "@tarojs/taro";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { AtAvatar, AtTag, AtIcon, AtTabBar } from "taro-ui";
|
import { AtAvatar, AtTag, AtIcon, AtTabBar, AtButton } from "taro-ui";
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
import beijing from "@/images/city/beijing.jpg";
|
import beijing from "@/images/city/beijing.jpg";
|
||||||
import guangzhou from "@/images/city/guangzhou.jpg";
|
import guangzhou from "@/images/city/guangzhou.jpg";
|
||||||
@@ -9,10 +9,14 @@ import shanghai from "@/images/city/shanghai.jpg";
|
|||||||
import shenzhen from "@/images/city/shenzhen.jpg";
|
import shenzhen from "@/images/city/shenzhen.jpg";
|
||||||
import touxiang from "@/images/index/touxiang.jpg";
|
import touxiang from "@/images/index/touxiang.jpg";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
// import beijing from "../../images/city/beijing.jpg";
|
// import beijing from "../../images/city/beijing.jpg";
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
|
// 用户基本信息
|
||||||
|
const [userInfo, setuserInfo] = useState({});
|
||||||
|
|
||||||
|
|
||||||
useLoad(() => {
|
useLoad(() => {
|
||||||
console.log("Page loaded.");
|
console.log("Page loaded.");
|
||||||
});
|
});
|
||||||
@@ -100,6 +104,27 @@ export default function Index() {
|
|||||||
<AtAvatar circle image={touxiang}></AtAvatar>
|
<AtAvatar circle image={touxiang}></AtAvatar>
|
||||||
{/* color="#F00" */}
|
{/* color="#F00" */}
|
||||||
<AtIcon value="chevron-down" size="30"></AtIcon>
|
<AtIcon value="chevron-down" size="30"></AtIcon>
|
||||||
|
<AtButton
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
Taro.request({
|
||||||
|
url: " http://172.19.0.1:8082/test", //仅为示例,并非真实的接口地址
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
openid: "111",
|
||||||
|
wxid: "22",
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"content-type": "application/json", // 默认值
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res.data);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
发起请求
|
||||||
|
</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 省份标签 */}
|
{/* 省份标签 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user