{"id":184578,"date":"2020-10-21T22:54:14","date_gmt":"2020-10-21T14:54:14","guid":{"rendered":"http:\/\/4563.org\/?p=184578"},"modified":"2020-10-21T22:54:14","modified_gmt":"2020-10-21T14:54:14","slug":"%e5%90%84%e4%bd%8d%e5%89%8d%e7%ab%af%e5%a4%a7%e4%bd%ac%ef%bc%8c%e8%af%b7%e6%95%99%e4%b8%80%e4%b8%aa%e8%8e%ab%e5%90%8d%e5%85%b6%e5%a6%99%e7%9a%84%e5%89%8d%e7%ab%af-js-%e9%97%ae%e9%a2%98%e3%80%82","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=184578","title":{"rendered":"\u5404\u4f4d\u524d\u7aef\u5927\u4f6c\uff0c\u8bf7\u6559\u4e00\u4e2a\u83ab\u540d\u5176\u5999\u7684\u524d\u7aef JS \u95ee\u9898\u3002"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5404\u4f4d\u524d\u7aef\u5927\u4f6c\uff0c\u8bf7\u6559\u4e00\u4e2a\u83ab\u540d\u5176\u5999\u7684\u524d\u7aef JS \u95ee\u9898\u3002               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wzl20001001 <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u64b8\u4ee3\u7801\u65f6\u51fa\u73b0\u4e86\u4e00\u4e2a\u5947\u602a\u7684 Bug \u3002<\/p>\n<p>\u4e3b\u8981\u903b\u8f91\u662f\u7528 axios \u83b7\u53d6\u540e\u7aef\u63a5\u53e3\u8fd4\u56de\u7684\u72b6\u6001\u7801\uff0c\u5982\u679c\u6210\u529f\u5219\u5c06\u8868\u5355\u503c\u7f6e\u4e3a\u7a7a\uff0c\u4ee5\u4fbf\u4e0b\u6b21\u6dfb\u52a0\u3002<\/p>\n<p>\u4f46\u662f\u5f53\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u7684\u65f6\u5019\uff0c\u8f93\u51fa\u7684\u5bf9\u8c61\u662f\u5148\u7ecf\u8fc7\u4e3b\u51fd\u6570\u7684 then \u4e2d\u7684\u8bed\u53e5\u66f4\u6539\u8fc7\u7684\u5bf9\u8c61\uff0c\u4f46\u662f\u5982\u679c\u8bfb\u53d6\u5176\u4e2d\u7684\u5c5e\u6027\u503c\uff0c\u5374\u662f\u672a\u7ecf\u8fc7\u66f4\u6539\u7684\u503c\u3002<\/p>\n<p>\u6d4b\u8bd5\u7684\u6267\u884c\u987a\u5e8f\u4e5f\u662f\u8f93\u51fa\u7684 1\uff0c2\uff0c3 \u7684\u987a\u5e8f(\u5148\u662f\u6267\u884c dispatch \u4e4b\u524d\u7684\u8bed\u53e5\uff0c\u63a5\u7740\u6267\u884c action\uff0c\u6700\u540e\u6267\u884c then \u4e2d\u7684\u8bed\u53e5)\u3002<\/p>\n<p>\u6709\u4e00\u70b9\u5b9e\u5728\u60f3\u4e0d\u901a\uff1a\u4e3a\u5565\u8fd8\u6ca1\u8fd0\u884c\u5230\u8d4b\u503c\u8bed\u53e5\uff0c\u76f4\u63a5\u8f93\u51fa\u5bf9\u8c61\u4f1a\u662f\u8d4b\u503c\u540e\u7684\u6837\u5b50\u3002\u800c\u4e14\u53ea\u6709\u8f93\u51fa\u5bf9\u8c61\u65f6\uff0c\u63a7\u5236\u53f0\u663e\u793a\u5bf9\u8c61\u7684\u5c5e\u6027\u503c\u662f\u66f4\u6539\uff0c\u4f46\u76f4\u63a5\u5bf9\u8c61\u4e2d\u7684\u5c5e\u6027\u503c\u65f6\u5374\u672a\u6539\u53d8\u3002<\/p>\n<p>\u8fd9\u662f\u4e3b\u51fd\u6570\uff1a<\/p>\n<pre><code>addBookmark() {    console.log(1)  \/\/ 1, \u6d4b\u8bd5\uff0c\u7528\u4e8e\u6d4b\u8bd5\u6267\u884c\u987a\u5e8f   console.log(this.newBookmarkInfo) \/\/ \u83b7\u53d6\u5230\u7684\u5bf9\u8c61\u662f\u7ecf\u8fc7\u8fc7 then \u4e2d\u4fee\u6539\u4e4b\u540e\u7684\u5bf9\u8c61 {bookmarkId:0, bookmarkTitle:1, bookmarkUrl:1}   console.log(this.newBookmarkInfo.bookmarkTitle) \/\/ \u83b7\u53d6\u5230\u7684\u662f\u672a\u7ecf\u66f4\u6539\u7684 title: \"title\"    this.$store.dispatch('addBookmark',this.newBookmarkInfo).then(() =&gt; { \/\/ \u8c03\u7528 Action      console.log(this.newBookmarkInfo) \/\/ \u540c\u6837\u662f\u503c\u66f4\u6539\u8fc7\u7684\u5bf9\u8c61     console.log(this.newBookmarkInfo.bookmarkTitle) \/\/ \u83b7\u53d6\u5230\u7684\u662f\u672a\u7ecf\u66f4\u6539\u7684\u5bf9\u8c61\u4e2d\u7684 title: \"title\"      \/\/ \u8d4b\u503c\u8bed\u53e5     this.newBookmarkInfo.bookmarkTitle='1'     this.newBookmarkInfo.bookmarkUrl='1'      console.log(3)  \/\/ 3      \/\/ \u5bf9\u8868\u5355\u72b6\u6001\u548c\u5f39\u7a97\u72b6\u6001\u7684\u91cd\u7f6e     this.$refs.obs.reset()     this.dialog = false   }).catch(error =&gt; {     console.log('error')     console.log(error.response)   }) }, <\/code><\/pre>\n<p>\u8fd9\u662f vuex \u4e2d\u7684 Action\uff1a<\/p>\n<pre><code>addBookmark(undefine, newBookmarkInfo){   console.log(2)  \/\/ 2    console.log(newBookmarkInfo)  \/\/ \u540c\u6837\u4e5f\u662f\u88ab\u66f4\u6539\u8fc7\u7684\u5bf9\u8c61   console.log(newBookmarkInfo.bookmarkTitile) \/\/ \u83b7\u53d6\u5230\u7684\u662f\u672a\u7ecf\u8fc7\u66f4\u6539\u7684 title   return new Promise((resolve,reject) =&gt; {     addBookmarkOne(newBookmarkInfo).then(resp =&gt; {       const { data } = resp       resolve(data)     }).catch(error =&gt; {       reject(error)     })   }) }, <\/code><\/pre>\n<p>\u8fd9\u662f\u8fd0\u884c\u7684\u63a7\u5236\u53f0\u622a\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/11\/20201103_5fa0e26d36f39.png\" alt=\"\u5404\u4f4d\u524d\u7aef\u5927\u4f6c\uff0c\u8bf7\u6559\u4e00\u4e2a\u83ab\u540d\u5176\u5999\u7684\u524d\u7aef JS \u95ee\u9898\u3002\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3973849\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shintendo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b80\u5355\u5730\u8bf4\uff0cchrome \u5728 console.log \u8f93\u51fa\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u8f93\u51fa\u7684\u662f\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u800c\u975e\u5bf9\u8c61\u5185\u5bb9\u7684\u201c\u5feb\u7167\u201d\uff0c\u4f60\u70b9+\u53f7\u5c55\u5f00\u7684\u65f6\u5019\u624d\u5bf9\u5185\u5bb9\u6c42\u503c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973850\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shintendo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8865\u5145\uff0c\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u4e00\u4e2a\u65b9\u6cd5\u662f console.log(JSON.parse(JSON.stringify(obj)))                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973851\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : wzl20001001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @shintendo \u61c2\u4e86\uff0c\u8c22\u8c22\u5927\u4f6c\u3002\u4e00\u76f4\u4ee5\u4e3a\u662f\u4ee3\u7801\u7684\u95ee\u9898\uff0c\u6ca1\u5f80\u8fd9\u65b9\u9762\u60f3\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973852\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SxqSachin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u53ef\u4ee5\u5c1d\u8bd5\u5728\u6bcf\u4e00\u53e5 console.log \u4e0b\u52a0\u4e00\u884c debugger;\uff0c\u6765\u770b\u90a3\u4e2a\u65f6\u70b9\u8fd9\u4e2a\u5bf9\u8c61\u7684\u503c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973853\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : azcvcza <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u706b\u72d0\u8fd8\u662f\u4ec0\u4e48\u6d4f\u89c8\u5668\u5c31\u4e25\u8c28\u4e00\u70b9\uff0c\u5230\u4e86\u5bf9\u8c61\u8be5\u8f93\u51fa\u7684\u65f6\u5019\u624d\u8f93\u51fa\u3002chrome \u7684\u8bdd\uff0c\u5982\u679c\u4e00\u5f00\u59cb\u4e00\u4e2a{},\u6253\u5370\u7684\u65f6\u5019\u6ca1\u503c\uff0c\u4f46\u5f02\u6b65\u4e4b\u540e\u6709\u503c\uff0c\u90a3\u4e48\u4e4b\u524d\u6253\u5370\u7684\u90a3\u6761\u4e5f\u4f1a\u53d8\u6210\u6709\u503c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973854\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fengmumu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @azcvcza \u706b\u72d0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973855\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : azcvcza <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @fengmumu \u53ef\u4ee5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3973856\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : wzl20001001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SxqSachin \u4eca\u5929\u665a\u4e0a\u641e\u5176\u4ed6\u7684\u7ec4\u4ef6\u7684\u65f6\u5019\u53d1\u73b0\u95ee\u9898\u4e86\uff0c\u5728\u503c\u4f20\u9012\u7684\u65f6\u5019\u6ca1\u6709\u8fdb\u884c\u5bf9\u8c61\u62f7\u8d1d\uff0c\u76f4\u63a5\u628a\u6e90\u5bf9\u8c61\u8d4b\u503c\u7ed9\u4e86\u53d8\u91cf\uff0c\u5bfc\u81f4\u4e86\u52a0\u5165 vuex \u7684\u4e00\u76f4\u662f\u5bf9\u6e90\u5bf9\u8c61\u7684\u5f15\u7528\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5404\u4f4d\u524d\u7aef\u5927\u4f6c\uff0c\u8bf7\u6559\u4e00\u4e2a\u83ab\u540d\u5176\u5999\u7684\u524d&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\/184578"}],"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=184578"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/184578\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184578"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}