Harmony学习记录

Harmony学习记录

axios

在这里插入图片描述

Get

export interface CodeApi{
  data: string,
  code: number,
  message: string
}
 .onClick(() =>{
    axios<null, AxiosResponse<CodeApi>,null> ({
      method: 'get',
      baseURL:'http://127.0.0.1:3000',
      timeout: 2000,
      url: '/word/user/code',
      params: {
        phone: this.phone
      }
    }).then((res: AxiosResponse<CodeApi>) => {
      this.code = res.data.data
    })
  }
 )

Post

.onClick(() => {
         axios.post<null, AxiosResponse<LoginApi>, postUserLogin>("http://127.0.0.1:3000/word/user/login", {
           phone: this.phone,
           code: this.code
         }).then((res: AxiosResponse<LoginApi>) => {
           this.token = res.data.data
         })
       })
export interface LoginApi {
 code: number,
 message: string,
 data: string
}
export interface postUserLogin{
  phone: string;
  code: string;
}

相关推荐

  1. 学习记录————

    2024-07-11 18:06:04       61 阅读
  2. mysql学习记录

    2024-07-11 18:06:04       39 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 18:06:04       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 18:06:04       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 18:06:04       58 阅读
  4. Python语言-面向对象

    2024-07-11 18:06:04       69 阅读

热门阅读

  1. 力扣题解( 最长递增子序列)

    2024-07-11 18:06:04       24 阅读
  2. less和sass有啥区别哪个更加好

    2024-07-11 18:06:04       22 阅读
  3. 7.10飞书一面面经

    2024-07-11 18:06:04       25 阅读
  4. mysql bit 对gorm使用何种类型?

    2024-07-11 18:06:04       26 阅读
  5. python爬虫学习(三十三天)---多线程上篇

    2024-07-11 18:06:04       23 阅读
  6. 一、Python 日志系统设计之不同级别的系统日志

    2024-07-11 18:06:04       21 阅读