<legend id='0611s'><style id='0611s'><dir id='0611s'><q id='0611s'></q></dir></style></legend>
      <bdo id='0611s'></bdo><ul id='0611s'></ul>
    <tfoot id='0611s'></tfoot>

      <i id='0611s'><tr id='0611s'><dt id='0611s'><q id='0611s'><span id='0611s'><b id='0611s'><form id='0611s'><ins id='0611s'></ins><ul id='0611s'></ul><sub id='0611s'></sub></form><legend id='0611s'></legend><bdo id='0611s'><pre id='0611s'><center id='0611s'></center></pre></bdo></b><th id='0611s'></th></span></q></dt></tr></i><div id='0611s'><tfoot id='0611s'></tfoot><dl id='0611s'><fieldset id='0611s'></fieldset></dl></div>
      1. <small id='0611s'></small><noframes id='0611s'>

      2. fetch 函数返回 Promise &lt;pending&gt;

        fetch function return Promise lt;pendinggt;(fetch 函数返回 Promise lt;pendinggt;)
          <bdo id='qKRyl'></bdo><ul id='qKRyl'></ul>
          1. <tfoot id='qKRyl'></tfoot>

            <legend id='qKRyl'><style id='qKRyl'><dir id='qKRyl'><q id='qKRyl'></q></dir></style></legend>

              • <small id='qKRyl'></small><noframes id='qKRyl'>

                    <tbody id='qKRyl'></tbody>

                  <i id='qKRyl'><tr id='qKRyl'><dt id='qKRyl'><q id='qKRyl'><span id='qKRyl'><b id='qKRyl'><form id='qKRyl'><ins id='qKRyl'></ins><ul id='qKRyl'></ul><sub id='qKRyl'></sub></form><legend id='qKRyl'></legend><bdo id='qKRyl'><pre id='qKRyl'><center id='qKRyl'></center></pre></bdo></b><th id='qKRyl'></th></span></q></dt></tr></i><div id='qKRyl'><tfoot id='qKRyl'></tfoot><dl id='qKRyl'><fieldset id='qKRyl'></fieldset></dl></div>
                  本文介绍了fetch 函数返回 Promise &lt;pending&gt;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我的代码在这里返回一个 Promise,因为我使用的是 then 语法,所以我不知道为什么会这样:-??

                  So my code here return a Promise and since I'm using then syntax I don't know why that happens :-??

                  fetch('someurltoAJsonFile.json')
                    .then(function(response) {
                      console.log(response.json());});
                  

                  推荐答案

                  node-fetch 库中的response.json() 也返回一个promise,改为尝试

                  response.json() in node-fetch library also returns a promise, instead try

                  fetch('someurltoAJsonFile.json')
                    .then(response => response.json())
                    .then(data => {
                      console.log(data)
                    });
                  

                  您可以在这里

                  返回的响应似乎不在有效的 json 中,所以为了完整起见,这里是文本代码

                  It seems that the returned response wasn't in the valid json, so for the sake of completeness here is a code for text

                  fetch('someurltoAJsonFile.json')
                    .then(response => response.text())
                    .then(data => {
                      console.log(data)
                    });
                  

                  这篇关于fetch 函数返回 Promise &lt;pending&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  业务场景:使用update语句去更新数据库字段。 原因:update接收值不正确。原来代码: $query = "UPDATE student SET date = now() WHERE id = $id";$result = $mysqli-query($query2) or die($mysqli-error); // 问题出现了在这句 $data = $result-fetch_ass
                  ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc
                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)

                  1. <tfoot id='WobHe'></tfoot>

                    <legend id='WobHe'><style id='WobHe'><dir id='WobHe'><q id='WobHe'></q></dir></style></legend>

                    <small id='WobHe'></small><noframes id='WobHe'>

                      <i id='WobHe'><tr id='WobHe'><dt id='WobHe'><q id='WobHe'><span id='WobHe'><b id='WobHe'><form id='WobHe'><ins id='WobHe'></ins><ul id='WobHe'></ul><sub id='WobHe'></sub></form><legend id='WobHe'></legend><bdo id='WobHe'><pre id='WobHe'><center id='WobHe'></center></pre></bdo></b><th id='WobHe'></th></span></q></dt></tr></i><div id='WobHe'><tfoot id='WobHe'></tfoot><dl id='WobHe'><fieldset id='WobHe'></fieldset></dl></div>

                          <tbody id='WobHe'></tbody>
                          • <bdo id='WobHe'></bdo><ul id='WobHe'></ul>