{"id":158478,"date":"2020-09-07T19:27:24","date_gmt":"2020-09-07T11:27:24","guid":{"rendered":"http:\/\/4563.org\/?p=158478"},"modified":"2020-09-07T19:27:24","modified_gmt":"2020-09-07T11:27:24","slug":"export-function-%e9%87%8c%e9%9d%a2%e5%8f%aa%e8%83%bd%e6%9c%89%e4%b8%80%e4%b8%aa-return-%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=158478","title":{"rendered":"export function \u91cc\u9762\u53ea\u80fd\u6709\u4e00\u4e2a return \u5417\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  export function \u91cc\u9762\u53ea\u80fd\u6709\u4e00\u4e2a return \u5417\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : coolair <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<pre><code>export function login(data) {     let formData= new FormData();     formData.append('username', 'admin');     formData.append('password', '123);      return request({         url: '\/o\/token\/',         method: 'post',         formData     }) } <\/code><\/pre>\n<p>request \u662f axios \u7684\u5c01\u88c5\uff0c\u53d1\u73b0\u5982\u679c\u8fd9\u6837 formData \u53d1\u4e0d\u51fa\u53bb\uff0c\u4f46\u662f\u5982\u679c\u76f4\u63a5\u4f20 formData \u7ed9 login \u51fd\u6570\uff0c\u800c\u4e0d\u5728 login \u51fd\u6570\u4e2d\u6784\u9020 formData \u5374\u53ef\u4ee5\u53d1\u51fa\u53bb\uff0c\u8fd9\u662f\u4e3a\u5565\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3391476\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : noe132 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8ba4\u771f\u770b\u6587\u6863\u4e86\u4e48\u3002\u3002\u3002axios \u7684\u53c2\u6570\u6ca1\u6709\u540d\u79f0\u4e3a formData \u7684\u3002\u4f60\u5f53\u7136\u53d1\u4e0d\u51fa\u53bb\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3391477\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codehz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a request \u63a5\u6536\u7684\u662f{url, method, data}\u8fd9\u6837\u7684\u7ed3\u6784\u5427\u3002\u3002\u3002<br \/>\u4f60 formData \u7528\u8fd9\u79cd\u7b80\u5199\u4e0d\u5c31\u53d8\u6210 formData: formData \u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3391478\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : maichael <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60 request \u662f\u600e\u4e48\u5c01\u88c5\u7684\uff1f request \u5165\u53c2\u5bf9\u8c61\u91cc\u7684\u5b57\u6bb5\u5230\u5e95\u662f formData \u8fd8\u662f data.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3391479\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : coolair <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @noe132 <br \/>@codehz <br \/>@maichael \u61c2\u4e86\uff0c\u89c1\u7b11\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>export function \u91cc&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/158478"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158478"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/158478\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158478"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}