faeat:fastapi本地网络请求调试

This commit is contained in:
hackrobot
2024-03-19 16:58:21 +08:00
parent 8b6683ee24
commit 73d3a3a166

View File

@@ -1,7 +1,7 @@
import { View, Text, Image } from "@tarojs/components";
import { useLoad } 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 beijing from "@/images/city/beijing.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 touxiang from "@/images/index/touxiang.jpg";
import { useEffect } from "react";
import { useEffect, useState } from "react";
// import beijing from "../../images/city/beijing.jpg";
export default function Index() {
// 用户基本信息
const [userInfo, setuserInfo] = useState({});
useLoad(() => {
console.log("Page loaded.");
});
@@ -100,6 +104,27 @@ export default function Index() {
<AtAvatar circle image={touxiang}></AtAvatar>
{/* color="#F00" */}
<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>
{/* 省份标签 */}