小编Pra*_* TP的帖子

vscode 在 jsconfig.json 文件中显示与打字稿相关的问题

我设置了一个普通的 create-react-app 项目并将 jsconfig.json 添加到根目录。但它显示了与打字稿相关的错误。 Vscode 终端出现问题 这是 jsconfig.json 文件

jsconfig.json 配置

文件夹结构

在此输入图像描述

谁能帮我这个?

谢谢,普拉希尔

javascript configuration typescript reactjs visual-studio-code

6
推荐指数
1
解决办法
2121
查看次数

无法使用react js将文件上传到django rest框架

我正在使用 react Js 将图像上传到 django restframework。在这里,我使用 fetch API 发送 post 请求。

应用程序.jsx

import React, { Component } from 'react';

class Eapp extends Component {
  constructor(props){
    super(props);
    this.state = {
      profilePic: null,
    };
    this.inpuElement = null;
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }
  handleChange(e){
    this.setState({profilePic: e.target.files[0]});
  }
  handleSubmit(){
    let formData = new FormData();
    formData.append('profile_pic',this.state.profilePic);
    fetch('http://10.42.0.1:8000/auth/profile-pic/', {
      method: 'POST',
      headers: {
        Accept: 'application/json, text/plain, */*',
        'content-type': 'multipart/form-data',
      },
      body:formData,
    }).then(res => res.json())
      .then((data) => {
        console.log(data);
      })
      .catch(err => console.log(err));
  }

  render(){ …
Run Code Online (Sandbox Code Playgroud)

python django reactjs

4
推荐指数
1
解决办法
6717
查看次数