chen21399 2019-02-16 00:23 采纳率: 0%
浏览 6436

ajax请求后端出现 Sorry, we need js to run correctly! 怎么办?

ajax请求后端出现 Sorry, we need js to run correctly! 的问题,但是直接访问可以获得数据,没有问题

图片说明

不知道是什么原因

//config文件代理部分
proxy: {
    '/api': {
      target: 'http://39.106.102.208',
      changeOrigin: false,
    },
  },


//api 文件
export const _showEassy = async action => {
  return await promise.request('/hospital/api.php', MethodType.GET, {
    action,
  });
};

//用ajax请求的文件
import { _showEassy, _searchEassy, _deleteEassy } from '../../utils/api';

async componentWillMount() {
    const goeassyshow = [];
    const show = await _showEassy('show_eassy');
    for (let i = 0; i < show.data.length; i++) {
      goeassyshow.push({
        id: show.data[i].id,
        title: show.data[i].title,
        tag: show.data[i].types,
        description: show.data[i].main,
        content: show.data[i].text,
        thumbnail: show.data[i].easyimage,
        color: 'red',
        path: `/article_manage/article-more/fix?id=${show.data[i].id}`,
      });
    }
    this.setState({
      eassyshow: goeassyshow,
    });
  }


  • 写回答

1条回答

  • chen21399 2019-02-16 00:41
    关注

    找到解决办法了,代理写错了

    //config文件代理部分
    proxy: {
        '/api': {
          target: 'http://39.106.102.208/hospital/',
          changeOrigin: false,
        },
      },
    
    
    //api 文件
    export const _showEassy = async action => {
      return await promise.request('/api.php', MethodType.GET, {
        action,
      });
    };
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog