{"id":83890,"date":"2020-05-11T03:19:40","date_gmt":"2020-05-10T19:19:40","guid":{"rendered":"http:\/\/4563.org\/?p=83890"},"modified":"2020-05-11T03:19:40","modified_gmt":"2020-05-10T19:19:40","slug":"vuex-%e4%bc%a0%e7%bb%99-action-%e7%9a%84%e7%ac%ac%e4%b8%89%e4%b8%aa%e5%8f%82%e6%95%b0%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=83890","title":{"rendered":"Vuex \u4f20\u7ed9 action \u7684\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u4ec0\u4e48"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Vuex \u4f20\u7ed9 action \u7684\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u4ec0\u4e48               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yuann72 <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>vuex.js:<\/p>\n<pre><code>export default new Vuex.Store({   state: {},   actions: {     toggleSideBar() {       console.log('actions', arguments)     }   } }) <\/code><\/pre>\n<p>\u7136\u540e\u5728\u63a7\u5236\u53f0\u5206\u522b\u6267\u884c <code>rootVue.$store.dispatch('toggleSideBar')<\/code> \u548c <code>rootVue.$store.dispatch('toggleSideBar', 1,2,3,4)<\/code><br \/> \u56fe\u4e2d\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u4ec0\u4e48, \u770b\u4e86\u6587\u6863\u597d\u50cf\u6ca1\u63d0\u5230\u8fc7\u8fd9\u7b2c\u4e09\u4e2a\u53c2\u6570 <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200515_5ebf0ec18b7cd.png\" alt=\"Vuex \u4f20\u7ed9 action \u7684\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u4ec0\u4e48\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1536383\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chenluo0429 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             dispatch: Dispatch;<\/p>\n<p>export interface Dispatch {<br \/> (type: string, payload?: any, options?: DispatchOptions): Promise&lt;any&gt;;<br \/> &lt;P extends Payload&gt;(payloadWithType: P, options?: DispatchOptions): Promise&lt;any&gt;;<br \/>}<\/p>\n<p>export interface DispatchOptions {<br \/> root?: boolean;<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1536384\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : FakerLeung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u731c\uff0c\u4eba\u5bb6\u6839\u672c\u5c31\u6ca1\u6709\u7b2c\u4e09\u4e2a\u53c2\u6570\u4f5c\u4e3a\u5165\u53c2\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1536385\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yuann72 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @FakerLeung #2 \u771f\u6ca1\u6709\u7684\u8bdd\uff0c\u5e94\u8be5\u662f\u6ca1\u6709\u7b2c\u4e09\u4e2a\u53c2\u6570\uff0c\u800c\u4e0d\u662f\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f undefined \u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Vuex \u4f20\u7ed9 action \u7684\u7b2c&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\/83890"}],"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=83890"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/83890\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83890"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}