{"id":2504,"date":"2020-03-27T09:51:34","date_gmt":"2020-03-27T01:51:34","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=2504"},"modified":"2020-03-27T09:58:07","modified_gmt":"2020-03-27T01:58:07","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%ac%ac%e4%b8%89%e6%96%b9%e6%a1%86%e6%9e%b6%e5%af%b9%e6%af%94-wepy-mpvue-taro","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=2504","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u7b2c\u4e09\u65b9\u6846\u67b6\u5bf9\u6bd4 ( wepy \/ mpvue \/ taro )"},"content":{"rendered":"<h1 class=\"postTitle\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/20200327094033.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2506\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/20200327094033.png\" alt=\"20200327094033\" width=\"860\" height=\"339\" \/><\/a><\/h1>\n<div class=\"postBody\">\n<div id=\"cnblogs_post_body\" class=\"blogpost-body \">\n<p>\u00a0 \u00a0 \u00a0\u4f17\u6240\u5468\u77e5\u5982\u4eca\u5e02\u9762\u4e0a\u7aef\u7684\u5f62\u6001\u591a\u79cd\u591a\u6837\uff0c\u624b\u673aWeb\u3001ReactNative\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f, \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f, \u5feb\u5e94\u7528\u7b49,\u6bcf\u4e00\u7aef\u90fd\u662f\u5de8\u5927\u7684\u6d41\u91cf\u5165\u53e3\uff0c\u5f53\u4e1a\u52a1\u8981\u6c42\u540c\u65f6\u5728\u4e0d\u540c\u7684\u7aef\u90fd\u8981\u6c42\u6709\u6240\u8868\u73b0\u7684\u65f6\u5019\uff0c\u9488\u5bf9\u4e0d\u540c\u7684\u7aef\u53bb\u7f16\u5199\u591a\u5957\u4ee3\u7801\u7684\u6210\u672c\u663e\u7136\u975e\u5e38\u9ad8\uff0c\u8fd9\u65f6\u5019\u53ea\u7f16\u5199\u4e00\u5957\u4ee3\u7801\u5c31\u80fd\u591f\u9002\u914d\u5230\u591a\u7aef\u7684\u80fd\u529b\u5c31\u663e\u5f97\u6781\u4e3a\u9700\u8981\u3002\u4f46\u9762\u5bf9\u76ee\u524d\u5e02\u9762\u4e0a\u6210\u719f\u7684\u5c0f\u7a0b\u5e8f\u7b2c\u4e09\u65b9\u6846\u67b6\u5982\u4f55\u9488\u5bf9\u81ea\u5df1\u7684\u9700\u6c42\u8fdb\u884c\u9009\u62e9\u4e5f\u662f\u4e00\u4e2a\u9ebb\u70e6\u4e8b,\u672c\u6587\u9488\u5bf9\u5f53\u524d\u5e02\u9762\u4e0a\u7684\u4e09\u5927\u8f6c\u8bd1\u6846\u67b6\u8fdb\u884c\u4e00\u4e2a\u7efc\u5408\u5bf9\u6bd4,\u5e0c\u671b\u80fd\u5bf9\u5927\u5bb6\u7684\u6280\u672f\u9009\u62e9\u6709\u6240\u5e2e\u52a9,\u5982\u6709\u54ea\u91cc\u4e0d\u59a5\u7684\u5730\u65b9\u5e0c\u671b\u6307\u6b63;<\/p>\n<h2>\u3000\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6709\u54ea\u4e9b\u75db\u70b9?<\/h2>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u9891\u7e41\u8c03\u7528 setData\u53ca setData\u8fc7\u7a0b\u4e2d\u9875\u9762\u8df3\u95ea<\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u7ec4\u4ef6\u5316\u652f\u6301\u80fd\u529b\u592a\u5f31(\u51e0\u4e4e\u6ca1\u6709)<\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u4e0d\u80fd\u4f7f\u7528 less\u3001scss \u7b49\u9884\u7f16\u8bd1\u5668<\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">request \u5e76\u53d1\u6b21\u6570\u9650\u5236<\/span><\/li>\n<\/ul>\n<h2>\u3000\u4e3a\u4ec0\u4e48\u4f7f\u7528\u7b2c\u4e09\u65b9\u6846\u67b6?<\/h2>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u53ea\u8981\u719f\u6089vue\u6216react\u5373\u53ef\u5feb\u901f\u4e0a\u624b,\u5b66\u4e60\u6210\u672c\u4f4e<span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u4e00\u5957\u4ee3\u7801\u53ef\u5728\u591a\u7aef\u7f16\u8bd1\u8fd0\u884c(\u5fae\u4fe1,\u652f\u4ed8\u5b9d,h5,RN)\u00a0\u00a0\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u6682\u4e0d\u5b8c\u5584<\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\">\u7ec4\u4ef6\u5316\u5f00\u53d1\uff0c\u5b8c\u7f8e\u89e3\u51b3\u7ec4\u4ef6\u9694\u79bb\uff0c\u7ec4\u4ef6\u5d4c\u5957\uff0c\u7ec4\u4ef6\u901a\u4fe1\u7b49\u95ee\u9898<\/li>\n<\/ul>\n<ul>\n<li class=\"p1\">\u652f\u6301\u4f7f\u7528\u7b2c\u4e09\u65b9 npm \u8d44\u6e90<\/li>\n<\/ul>\n<ul>\n<li class=\"p1\">\u4f7f\u5c0f\u7a0b\u5e8f\u53ef\u652f\u6301 Promise\uff0c\u89e3\u51b3\u56de\u8c03\u70e6\u607c<\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u53ef\u4f7f\u7528 Generator Fu-nction \/ Class \/ Async Function \u7b49\u7279\u6027\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387<\/span><\/li>\n<\/ul>\n<ul>\n<li class=\"p1\">\u5bf9\u5c0f\u7a0b\u5e8f\u672c\u8eab\u7684\u4f18\u5316\uff0c\u5982\u751f\u547d\u5468\u671f\u7684\u8865\u5145\uff0c\u6027\u80fd\u7684\u4f18\u5316\u7b49\u7b49<\/li>\n<\/ul>\n<ul>\n<li class=\"p1\"><span class=\"s1\">\u652f\u6301\u6837\u5f0f\u7f16\u8bd1\u5668: Scss\/Less\uff0c\u6a21\u677f\u7f16\u8bd1\u5668\uff0c\u4ee3\u7801\u7f16\u8bd1\u5668\uff1aBabel\/Typescript\u3002<\/span><\/li>\n<\/ul>\n<h2>\u00a0 \u00a0 \u7b2c\u4e09\u65b9\u6846\u67b6\u5bf9\u6bd4 wepy mpvue taro<\/h2>\n<p>\u5728\u8fd9\u91cc\u6211\u901a\u8fc7\u5bf9\u76ee\u524d\u5df2\u5f00\u6e90\u7684\u4e09\u79cd\u5e38\u7528\u5c0f\u7a0b\u5e8f\u6846\u67b6\u505a\u4e00\u4e2a\u7efc\u5408\u5bf9\u6bd4, \u8fd8\u6709\u4e00\u4e2a\u53ebnanchi\u7684\u57fa\u4e8ereact\u7684\u5c0f\u7a0b\u5e8f\u8f6c\u8bd1\u6846\u67b6,\u7531\u4e8e\u6ca1\u6765\u7684\u53ca\u7814\u7a76\u6682\u4e0d\u505a\u6bd4\u8f83;<\/p>\n<ul>\n<li>\n<h3><strong>WEPY\u00a0<\/strong>https:\/\/tencent.github.io\/wepy\/document.html<\/h3>\n<\/li>\n<\/ul>\n<p><strong>\u3000\u3000<\/strong>\u817e\u8baf\u56e2\u961f\u5f00\u6e90\u7684\u4e00\u6b3e\u7c7bvue\u8bed\u6cd5\u89c4\u8303\u7684\u5c0f\u7a0b\u5e8f\u6846\u67b6,\u501f\u9274\u4e86Vue\u7684\u8bed\u6cd5\u98ce\u683c\u548c\u529f\u80fd\u7279\u6027,\u652f\u6301\u4e86Vue\u7684\u8bf8\u591a\u7279\u5f81\uff0c\u6bd4\u5982\u7236\u5b50\u7ec4\u4ef6\u3001\u7ec4\u4ef6\u4e4b\u95f4\u7684\u901a\u4fe1\u3001computed\u5c5e\u6027\u8ba1\u7b97\u3001wathcer\u76d1\u542c\u5668\u3001props\u4f20\u503c\u3001slot\u69fd\u5206\u53d1\uff0c\u8fd8\u6709\u5f88\u591a\u9ad8\u7ea7\u7684\u7279\u5f81\u652f\u6301\uff1aMixin\u6df7\u5408\u3001\u62e6\u622a\u5668\u7b49;WePY\u53d1\u5e03\u7684\u7b2c\u4e00\u4e2a\u7248\u672c\u662f2016\u5e7412\u6708\u4efd\uff0c\u4e5f\u5c31\u662f\u5c0f\u7a0b\u5e8f\u521a\u521a\u63a8\u51fa\u7684\u65f6\u5019\uff0c\u5230\u76ee\u524d\u4e3a\u6b62\uff0cWePY\u5df2\u7ecf\u53d1\u5e03\u4e8652\u4e2a\u7248\u672c, \u6700\u65b0\u7248\u672c\u4e3a1.7.2;<\/p>\n<ul>\n<li>\n<h3><strong>MpVue\u00a0<\/strong>http:\/\/mpvue.com\/mpvue\/#-html<\/h3>\n<\/li>\n<\/ul>\n<p><strong>\u3000<\/strong>\u3000\u7f8e\u56e2\u56e2\u961f\u5f00\u6e90\u7684\u4e00\u6b3e\u4f7f\u7528 Vue.js \u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u524d\u7aef\u6846\u67b6\u3002\u4f7f\u7528\u6b64\u6846\u67b6\uff0c\u5f00\u53d1\u8005\u5c06\u5f97\u5230\u5b8c\u6574\u7684 Vue.js \u5f00\u53d1\u4f53\u9a8c\uff0c\u540c\u65f6\u4e3a H5 \u548c\u5c0f\u7a0b\u5e8f\u63d0\u4f9b\u4e86\u4ee3\u7801\u590d\u7528\u7684\u80fd\u529b\u3002mpvue\u5728\u53d1\u5e03\u540e\u7684\u51e0\u5929\u95f4\u83b7\u5f972.7k\u7684star,\u4e0a\u5347\u901f\u5ea6\u98de\u8d77,\u622a\u81f3\u76ee\u524d\u4e3a\u6b62\u5df2\u7ecf\u670913.7k\u7684star;<\/p>\n<ul>\n<li>\n<h3><strong>Taro\u00a0https:\/\/taro.aotu.io\/<\/strong><\/h3>\n<\/li>\n<\/ul>\n<p><strong>\u3000<\/strong>\u3000\u4eac\u4e1c\u51f9\u51f8\u5b9e\u9a8c\u5ba4\u5f00\u6e90\u7684\u4e00\u6b3e\u4f7f\u7528 React.js \u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u524d\u7aef\u6846\u67b6\u3002\u5b83\u91c7\u7528\u4e0e React \u4e00\u81f4\u7684\u7ec4\u4ef6\u5316\u601d\u60f3\uff0c\u7ec4\u4ef6\u751f\u547d\u5468\u671f\u4e0e React \u4fdd\u6301\u4e00\u81f4\uff0c\u540c\u65f6\u652f\u6301\u4f7f\u7528 JSX \u8bed\u6cd5\uff0c\u8ba9\u4ee3\u7801\u5177\u6709\u66f4\u4e30\u5bcc\u7684\u8868\u73b0\u529b\uff0c\u4f7f\u7528\u00a0Taro\u00a0\u8fdb\u884c\u5f00\u53d1\u53ef\u4ee5\u83b7\u5f97\u548c React \u4e00\u81f4\u7684\u5f00\u53d1\u4f53\u9a8c\u3002,\u540c\u65f6\u56e0\u4e3a\u4f7f\u7528\u4e86react\u7684\u539f\u56e0\u6240\u4ee5\u9664\u4e86\u80fd\u7f16\u8bd1h5, \u5c0f\u7a0b\u5e8f\u5916\u8fd8\u53ef\u4ee5\u7f16\u8bd1\u4e3aReactNative;<\/p>\n<h2><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200327094550.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2508\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200327094550.png\" alt=\"\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200327094550\" width=\"877\" height=\"693\" \/><\/a><\/h2>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-2509\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/1055667-20181017200144824-1272624771.png\" alt=\"1055667-20181017200144824-1272624771\" width=\"845\" height=\"539\" \/><\/p>\n<h2>\u3000\u751f\u547d\u5468\u671f<\/h2>\n<p><strong>\u540c\u4e3avue\u89c4\u8303\u7684mpvue\u548cwepy\u7684\u751f\u547d\u5468\u671f\u548c\u5404\u79cd\u65b9\u6cd5\u4e0d\u5c3d\u76f8\u540c<\/strong><\/p>\n<h3>\u3000\u3000wepy<\/h3>\n<p>wepy\u751f\u547d\u5468\u671f\u57fa\u672c\u4e0e\u539f\u751f\u5c0f\u7a0b\u5e8f\u76f8\u540c,\u518d\u6b64\u57fa\u7840\u4e0a\u7cc5\u5408\u4e86\u4e00\u4e9bvue\u7684\u7279\u6027; \u5bf9\u4e8eWePY\u4e2d\u7684methods\u5c5e\u6027\uff0c\u56e0\u4e3a\u4e0eVue\u4e2d\u7684\u4f7f\u7528\u4e60\u60ef\u4e0d\u4e00\u81f4\uff0c\u975e\u5e38\u5bb9\u6613\u9020\u6210\u8bef\u89e3\uff0c\u8fd9\u91cc\u9700\u8981\u7279\u522b\u5f3a\u8c03\u4e00\u4e0b\uff1aWePY\u4e2d\u7684methods\u5c5e\u6027\u53ea\u80fd\u58f0\u660e\u9875\u9762wxml\u6807\u7b7e\u7684bind\u3001catch\u4e8b\u4ef6\uff0c\u4e0d\u80fd\u58f0\u660e\u81ea\u5b9a\u4e49\u65b9\u6cd5\uff0c\u8fd9\u4e0eVue\u4e2d\u7684\u7528\u6cd5\u662f\u4e0d\u4e00\u81f4\u7684\u3002<\/p>\n<div class=\"cnblogs_code\">\n<pre>import wepy from 'wepy';\r\n\r\nexport default class MyPage extends wepy.page {\r\n\/\/ export default class MyComponent extends wepy.component {\r\n    customData = {}  \/\/ \u81ea\u5b9a\u4e49\u6570\u636e\r\n\r\n    customFunction ()\u3000{}  \/\/\u81ea\u5b9a\u4e49\u65b9\u6cd5\r\n\r\n    onLoad () {}  \/\/ \u5728Page\u548cComponent\u5171\u7528\u7684\u751f\u547d\u5468\u671f\u51fd\u6570\r\n\r\n    onShow () {}  \/\/ \u53ea\u5728Page\u4e2d\u5b58\u5728\u7684\u9875\u9762\u751f\u547d\u5468\u671f\u51fd\u6570\r\n\r\n    config = {};  \/\/ \u53ea\u5728Page\u5b9e\u4f8b\u4e2d\u5b58\u5728\u7684\u914d\u7f6e\u6570\u636e\uff0c\u5bf9\u5e94\u4e8e\u539f\u751f\u7684page.json\u6587\u4ef6\r\n\r\n    data = {};  \/\/ \u9875\u9762\u6240\u9700\u6570\u636e\u5747\u9700\u5728\u8fd9\u91cc\u58f0\u660e\uff0c\u53ef\u7528\u4e8e\u6a21\u677f\u6570\u636e\u7ed1\u5b9a\r\n\r\n    components = {};  \/\/ \u58f0\u660e\u9875\u9762\u4e2d\u6240\u5f15\u7528\u7684\u7ec4\u4ef6\uff0c\u6216\u58f0\u660e\u7ec4\u4ef6\u4e2d\u6240\u5f15\u7528\u7684\u5b50\u7ec4\u4ef6\r\n\r\n    mixins = [];  \/\/ \u58f0\u660e\u9875\u9762\u6240\u5f15\u7528\u7684Mixin\u5b9e\u4f8b\r\n\r\n    computed = {};  \/\/ \u58f0\u660e\u8ba1\u7b97\u5c5e\u6027\uff08\u8be6\u89c1\u540e\u6587\u4ecb\u7ecd\uff09\r\n\r\n    watch = {};  \/\/ \u58f0\u660e\u6570\u636ewatcher\uff08\u8be6\u89c1\u540e\u6587\u4ecb\u7ecd\uff09\r\n\r\n    methods = {};  \/\/ \u58f0\u660e\u9875\u9762wxml\u4e2d\u6807\u7b7e\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u3002\u6ce8\u610f\uff0c\u6b64\u5904\u53ea\u7528\u4e8e\u58f0\u660e\u9875\u9762wxml\u4e2d\u6807\u7b7e\u7684bind\u3001catch\u4e8b\u4ef6\uff0c\u81ea\u5b9a\u4e49\u65b9\u6cd5\u9700\u4ee5\u81ea\u5b9a\u4e49\u65b9\u6cd5\u7684\u65b9\u5f0f\u58f0\u660e\r\n\r\n    events = {};  \/\/ \u58f0\u660e\u7ec4\u4ef6\u4e4b\u95f4\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\r\n}<\/pre>\n<\/div>\n<p>mpvue<\/p>\n<p>mpvue\u00a0\u9664\u4e86 Vue \u672c\u8eab\u7684\u751f\u547d\u5468\u671f\u5916\uff0c\u8fd8\u517c\u5bb9\u4e86\u5c0f\u7a0b\u5e8f\u751f\u547d\u5468\u671f\uff0c\u8fd9\u90e8\u5206\u751f\u547d\u5468\u671f\u94a9\u5b50\u7684\u6765\u6e90\u4e8e<a href=\"https:\/\/mp.weixin.qq.com\/debug\/wxadoc\/dev\/framework\/app-service\/page.html\">\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684 Page<\/a>\uff0c \u9664\u7279\u6b8a\u60c5\u51b5\u5916\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5c0f\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f \u94a9\u5b50\u3002<\/p>\n<div class=\"cnblogs_code\">\n<pre> 1<strong>Vue<\/strong>\r\n 3 beforeCreate\r\n 4 created\r\n 5 beforeMount\r\n 6 mounted\r\n 7 beforeUpdate\r\n 8 updated\r\n 9 activated\r\n10 deactivated\r\n11 beforeDestroy\r\n12 destroyed\r\n13 <strong>app \u90e8\u5206<\/strong>\r\n15 onLaunch\uff0c\u521d\u59cb\u5316\r\n16 onShow\uff0c\u5f53\u5c0f\u7a0b\u5e8f\u542f\u52a8\uff0c\u6216\u4ece\u540e\u53f0\u8fdb\u5165\u524d\u53f0\u663e\u793a\r\n17 onHide\uff0c\u5f53\u5c0f\u7a0b\u5e8f\u4ece\u524d\u53f0\u8fdb\u5165\u540e\u53f0\r\n18 <strong>page \u90e8\u5206<\/strong>\r\n20 onLoad\uff0c\u76d1\u542c\u9875\u9762\u52a0\u8f7d\r\n21 onShow\uff0c\u76d1\u542c\u9875\u9762\u663e\u793a\r\n22 onReady\uff0c\u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210\r\n23 onHide\uff0c\u76d1\u542c\u9875\u9762\u9690\u85cf\r\n24 onUnload\uff0c\u76d1\u542c\u9875\u9762\u5378\u8f7d\r\n25 onPullDownRefresh\uff0c\u76d1\u542c\u7528\u6237\u4e0b\u62c9\u52a8\u4f5c\r\n26 onReachBottom\uff0c\u9875\u9762\u4e0a\u62c9\u89e6\u5e95\u4e8b\u4ef6\u7684\u5904\u7406\u51fd\u6570\r\n27 onShareAppMessage\uff0c\u7528\u6237\u70b9\u51fb\u53f3\u4e0a\u89d2\u5206\u4eab\r\n28 onPageScroll\uff0c\u9875\u9762\u6eda\u52a8\r\n29 onTabItemTap, \u5f53\u524d\u662f tab \u9875\u65f6\uff0c\u70b9\u51fb tab \u65f6\u89e6\u53d1 \uff08mpvue 0.0.16 \u652f\u6301\uff09<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<p>\u7b80\u5355\u793a\u4f8b<\/p>\n<div class=\"cnblogs_code\">\n<pre>new Vue({\r\n  data: {\r\n    a: 1\r\n  },\r\n  created () {\r\n    \/\/ `this` \u6307\u5411 vm \u5b9e\u4f8b\r\n    console.log('a is: ' + this.a)\r\n  },\r\n  onShow () {\r\n    \/\/ `this` \u6307\u5411 vm \u5b9e\u4f8b\r\n    console.log('a is: ' + this.a, '\u5c0f\u7a0b\u5e8f\u89e6\u53d1\u7684 onshow')\r\n  }\r\n})\r\n\/\/ =&gt; \"a is: 1\"<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<h3>\u00a0taro\u4e0ereact\u751f\u547d\u5468\u671f\u5b8c\u5168\u76f8\u540c<\/h3>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<pre>class Clock extends Component {\r\n  constructor (props) {\r\n    super(props)\r\n    this.state = { date: new Date() }\r\n  }\r\n\r\n  <strong>componentDidMount<\/strong>() {\r\n\r\n  }\r\n\r\n  <strong>componentWillUnmount<\/strong>() {\r\n\r\n  }\r\n\r\n  render () {\r\n    return (\r\n      &lt;View&gt;\r\n        &lt;Text&gt;Hello, world!&lt;\/Text&gt;\r\n        &lt;Text&gt;\u73b0\u5728\u7684\u65f6\u95f4\u662f {this.state.date.toLocaleTimeString()}.&lt;\/Text&gt;\r\n      &lt;\/View&gt;\r\n    )\r\n  }\r\n}<\/pre>\n<\/div>\n<h2>\u5217\u8868\u6e32\u67d3<\/h2>\n<h3>\u5728\u5217\u8868\u6e32\u67d3\u4e0a\u4e09\u8005\u4e5f\u5206\u522b\u6709\u4e0d\u540c\u7684\u5e94\u7528\u65b9\u6cd5<\/h3>\n<p><strong>wepy<\/strong>\u5f53\u9700\u8981\u5faa\u73af\u6e32\u67d3WePY\u7ec4\u4ef6\u65f6(\u7c7b\u4f3c\u4e8e\u901a\u8fc7<code>wx:for<\/code>\u5faa\u73af\u6e32\u67d3\u539f\u751f\u7684wxml\u6807\u7b7e)\uff0c\u5fc5\u987b\u4f7f\u7528WePY\u5b9a\u4e49\u7684\u8f85\u52a9\u6807\u7b7e<strong><code>&lt;repeat&gt;<\/code><\/strong><\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<pre>&lt;template&gt;\r\n    &lt;!-- \u6ce8\u610f\uff0c\u4f7f\u7528for\u5c5e\u6027\uff0c\u800c\u4e0d\u662f\u4f7f\u7528wx:for\u5c5e\u6027 --&gt;\r\n   <strong> &lt;repeat for=\"{{list}}\" key=\"index\" index=\"index\" item=\"item\"&gt;<\/strong>\r\n        &lt;!-- \u63d2\u5165&lt;script&gt;\u811a\u672c\u90e8\u5206\u6240\u58f0\u660e\u7684child\u7ec4\u4ef6\uff0c\u540c\u65f6\u4f20\u5165item --&gt;\r\n        &lt;child :item=\"item\"&gt;&lt;\/child&gt;\r\n   <strong> &lt;\/repeat&gt;<\/strong>\r\n&lt;\/template&gt;\r\n\r\n&lt;script&gt;\r\n    import wepy from 'wepy';\r\n    \/\/ \u5f15\u5165child\u7ec4\u4ef6\u6587\u4ef6\r\n    import Child from '..\/components\/child';\r\n\r\n    export default class Index extends wepy.component {\r\n        components = {\r\n            \/\/ \u58f0\u660e\u9875\u9762\u4e2d\u8981\u4f7f\u7528\u5230\u7684Child\u7ec4\u4ef6\u7684ID\u4e3achild\r\n            child: Child\r\n        }\r\n\r\n        data = {\r\n            list: [{id: 1, title: 'title1'}, {id: 2, title: 'title2'}]\r\n        }\r\n    }\r\n&lt;\/script&gt;<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<p><strong>mpvue<\/strong>\u4f7f\u7528v-for\u4e0evue\u4e00\u81f4,\u53ea\u662f\u9700\u8981\u6ce8\u610f\u4e00\u70b9\uff0c\u5d4c\u5957\u5217\u8868\u6e32\u67d3\uff0c\u5fc5\u987b\u6307\u5b9a\u4e0d\u540c\u7684\u7d22\u5f15\uff01<\/p>\n<div class=\"cnblogs_code\">\n<pre>&lt;!-- \u5728\u8fd9\u79cd\u5d4c\u5957\u5faa\u73af\u7684\u65f6\u5019\uff0c index \u548c itemIndex \u8fd9\u79cd\u7d22\u5f15\u662f\u5fc5\u987b\u6307\u5b9a\uff0c\u4e14\u522b\u540d\u4e0d\u80fd\u76f8\u540c\uff0c\u6b63\u786e\u7684\u5199\u6cd5\u5982\u4e0b --&gt;\r\n&lt;template&gt;\r\n    &lt;ul<strong> v-for=\"(card, index) in list\"<\/strong>&gt;\r\n        &lt;li v-for=\"(item, itemIndex) in card\"&gt;\r\n            {{item.value}}\r\n        &lt;\/li&gt;\r\n    &lt;\/ul&gt;\r\n&lt;\/template&gt;<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<p><strong>taro<\/strong>\u7684\u5217\u8868\u5faa\u73af\u7528\u6cd5\u57fa\u672c\u4e0ereact\u76f8\u540c,\u6709\u4e00\u70b9\u9700\u8981\u6ce8\u610f,\u5728 React \u4e2d\uff0cJSX \u662f\u4f1a\u7f16\u8bd1\u6210\u666e\u901a\u7684 JS \u7684\u6267\u884c\uff0c\u6bcf\u4e00\u4e2a JSX \u5143\u7d20\uff0c\u5176\u5b9e\u4f1a\u901a\u8fc7\u00a0<code>createElement<\/code>\u00a0\u51fd\u6570\u521b\u5efa\u6210\u4e00\u4e2a JavaScript \u5bf9\u8c61\uff08React Element\uff09\uff0c\u56e0\u6b64\u5b9e\u9645\u4e0a\u4f60\u53ef\u4ee5\u8fd9\u6837\u5199\u4ee3\u7801 React \u4e5f\u662f\u5b8c\u5168\u80fd\u6e32\u67d3\u7684\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<pre>const list = this.state.list.map(l =&gt; {\r\n  if (l.selected) {\r\n    return &lt;li&gt;{l.text}&lt;\/li&gt;\r\n  }\r\n}).filter(React.isValidElement)<\/pre>\n<\/div>\n<p>\u4f46\u662f Taro \u4e2d\uff0cJSX \u4f1a\u7f16\u8bd1\u6210\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6a21\u677f\u5b57\u7b26\u4e32\uff0c\u56e0\u6b64\u4f60\u4e0d\u80fd\u628a\u00a0<code>map<\/code>\u00a0\u51fd\u6570\u751f\u6210\u7684\u6a21\u677f\u5f53\u505a\u4e00\u4e2a\u6570\u7ec4\u6765\u5904\u7406\u3002\u5f53\u4f60\u9700\u8981\u8fd9\u4e48\u505a\u65f6\uff0c\u5e94\u8be5\u5148\u5904\u7406\u9700\u8981\u5faa\u73af\u7684\u6570\u7ec4\uff0c\u518d\u7528\u5904\u7406\u597d\u7684\u6570\u7ec4\u6765\u8c03\u7528 map \u51fd\u6570\u3002\u4f8b\u5982\u4e0a\u4f8b\u5e94\u8be5\u5199\u6210\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<pre>const list = this.state.list\r\n  .filter(l =&gt; l.selected)\r\n  .map(l =&gt; {\r\n    return &lt;li&gt;{l.text}&lt;\/li&gt;\r\n  })<\/pre>\n<\/div>\n<h2>\u4e8b\u4ef6\u5904\u7406<\/h2>\n<p><strong>mpvue<\/strong>\u76ee\u524d\u5168\u652f\u6301\u5c0f\u7a0b\u5e8f\u7684\u4e8b\u4ef6\u5904\u7406\u5668,\u5f15\u5165\u4e86 Vue.js \u7684\u865a\u62df DOM \uff0c\u5728\u524d\u6587\u6a21\u7248\u4e2d\u7ed1\u5b9a\u7684\u4e8b\u4ef6\u4f1a\u88ab\u6302\u5728\u5230 vnode \u4e0a\uff0c\u540c\u65f6 compiler \u5728 wxml \u4e0a\u7ed1\u5b9a\u4e86\u5c0f\u7a0b\u5e8f\u7684\u4e8b\u4ef6\uff0c\u5e76\u505a\u4e86\u76f8\u5e94\u7684\u6620\u5c04\uff0c\u6240\u4ee5\u4f60\u5728\u771f\u5b9e\u70b9\u51fb\u7684\u65f6\u5019\u901a\u8fc7 runtime \u4e2d\u00a0<code>handleProxy<\/code>\u00a0\u901a\u8fc7\u4e8b\u4ef6\u7c7b\u578b\u5206\u53d1\u5230 vnode \u7684\u4e8b\u4ef6\u4e0a\uff0c\u540c Vue \u5728 WEB \u7684\u673a\u5236\u4e00\u6837\uff0c\u6240\u4ee5\u53ef\u4ee5\u505a\u5230\u65e0\u635f\u652f\u6301\u3002\u540c\u65f6\u8fd8\u987a\u4fbf\u652f\u6301\u4e86\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u548c\u00a0<code>$emit<\/code>\u00a0\u673a\u5236<\/p>\n<div class=\"cnblogs_code\">\n<pre>\/\/ \u4e8b\u4ef6\u6620\u5c04\u8868\uff0c\u5de6\u4fa7\u4e3a WEB \u4e8b\u4ef6\uff0c\u53f3\u4fa7\u4e3a \u5c0f\u7a0b\u5e8f \u5bf9\u5e94\u4e8b\u4ef6\r\n{\r\n    click: 'tap',\r\n    touchstart: 'touchstart',\r\n    touchmove: 'touchmove',\r\n    touchcancel: 'touchcancel',\r\n    touchend: 'touchend',\r\n    tap: 'tap',\r\n    longtap: 'longtap',\r\n    input: 'input',\r\n    change: 'change',\r\n    submit: 'submit',\r\n    blur: 'blur',\r\n    focus: 'focus',\r\n    reset: 'reset',\r\n    confirm: 'confirm',\r\n    columnchange: 'columnchange',\r\n    linechange: 'linechange',\r\n    error: 'error',\r\n    scrolltoupper: 'scrolltoupper',\r\n    scrolltolower: 'scrolltolower',\r\n    scroll: 'scroll'\r\n}<\/pre>\n<\/div>\n<p>\u8e29\u5751\u6ce8\u610f(\u5b98\u65b9\u6587\u6863)\uff1a<\/p>\n<ul>\n<li>\u5217\u8868\u4e2d\u6ca1\u6709\u7684\u539f\u751f\u4e8b\u4ef6\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4f8b\u5982 bindregionchange \u4e8b\u4ef6\u76f4\u63a5\u5728 dom \u4e0a\u5c06bind\u6539\u4e3a@\u00a0<code>@regionchange<\/code>,\u540c\u65f6\u8fd9\u4e2a\u4e8b\u4ef6\u4e5f\u975e\u5e38\u7279\u6b8a\uff0c\u5b83\u7684 event type \u6709 begin \u548c end \u4e24\u4e2a\uff0c\u5bfc\u81f4\u6211\u4eec\u65e0\u6cd5\u5728<code>handleProxy<\/code>\u00a0\u4e2d\u533a\u5206\u5230\u5e95\u662f\u4ec0\u4e48\u4e8b\u4ef6\uff0c\u6240\u4ee5\u4f60\u5728\u76d1\u542c\u6b64\u7c7b\u4e8b\u4ef6\u7684\u65f6\u5019\u540c\u65f6\u76d1\u542c\u4e8b\u4ef6\u540d\u548c\u4e8b\u4ef6\u7c7b\u578b\u65e2\u00a0<code>&lt;map @regionchange=\"functionName\" @end=\"functionName\" @begin=\"functionName\"&gt;&lt;map&gt;<\/code><\/li>\n<li>\u5c0f\u7a0b\u5e8f\u80fd\u529b\u6240\u81f4\uff0cbind \u548c catch \u4e8b\u4ef6\u540c\u65f6\u7ed1\u5b9a\u65f6\u5019\uff0c\u53ea\u4f1a\u89e6\u53d1 bind ,catch \u4e0d\u4f1a\u88ab\u89e6\u53d1\uff0c\u8981\u907f\u514d\u8e29\u5751\u3002<\/li>\n<li>\u4e8b\u4ef6\u4fee\u9970\u7b26\n<ul>\n<li><code>.stop<\/code>\u00a0\u7684\u4f7f\u7528\u4f1a\u963b\u6b62\u5192\u6ce1\uff0c\u4f46\u662f\u540c\u65f6\u7ed1\u5b9a\u4e86\u4e00\u4e2a\u975e\u5192\u6ce1\u4e8b\u4ef6\uff0c\u4f1a\u5bfc\u81f4\u8be5\u5143\u7d20\u4e0a\u7684 catchEventName \u5931\u6548\uff01<\/li>\n<li><code>.prevent<\/code>\u00a0\u53ef\u4ee5\u76f4\u63a5\u5e72\u6389\uff0c\u56e0\u4e3a\u5c0f\u7a0b\u5e8f\u91cc\u6ca1\u6709\u4ec0\u4e48\u9ed8\u8ba4\u4e8b\u4ef6\uff0c\u6bd4\u5982submit\u5e76\u4e0d\u4f1a\u8df3\u8f6c\u9875\u9762<\/li>\n<li><code>.capture<\/code>\u00a0\u652f\u6301\u00a0<code>1.0.9<\/code><\/li>\n<li><code>.self<\/code>\u00a0\u6ca1\u6709\u53ef\u4ee5\u5224\u65ad\u7684\u6807\u8bc6<\/li>\n<li><code>.once<\/code>\u00a0\u4e5f\u4e0d\u80fd\u505a\uff0c\u56e0\u4e3a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 removeEventListener, \u867d\u7136\u53ef\u4ee5\u76f4\u63a5\u5728 handleProxy \u4e2d\u5904\u7406\uff0c\u4f46\u975e\u5e38\u7684\u4e0d\u4f18\u96c5\uff0c\u8fdd\u80cc\u4e86\u539f\u610f\uff0c\u6682\u4e0d\u8003\u8651<\/li>\n<\/ul>\n<\/li>\n<li>\u5176\u4ed6 \u952e\u503c\u4fee\u9970\u7b26 \u7b49\u5728\u5c0f\u7a0b\u5e8f\u4e2d\u538b\u6839\u6ca1\u952e\u76d8\uff0c\u6240\u4ee5\u3002\u3002\u3002<\/li>\n<\/ul>\n<p><strong>wepy<\/strong>\u4e8b\u4ef6\u7ed1\u5b9a\u533a\u522b\u4e8evue,\u6839\u636e\u539f\u751f\u5c0f\u7a0b\u5e8f\u4e8b\u4ef6\u63d0\u4f9b\u4e86\u8bed\u6cd5\u4f18\u5316<\/p>\n<p class=\"p1\"><span class=\"s1\"><strong>\u7ed1\u5b9a\u4e8b\u4ef6<\/strong><span class=\"s2\"><br \/>\n<span class=\"Apple-converted-space\">\u00a0bindtap=&#8221;click&#8221; \u66ff\u6362\u4e3a\u00a0<span class=\"s3\">@tap<span class=\"s2\">=&#8221;click&#8221;\uff0c<br \/>\n<span class=\"s1\"><strong>\u53d6\u6d88\u5192\u6ce1<\/strong><span class=\"s2\"><br \/>\n\u539fcatchtap=&#8221;click&#8221;\u66ff\u6362\u4e3a<span class=\"s3\">@tap.stop<span class=\"s2\">=&#8221;click&#8221;\u3002<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p class=\"p1\"><span class=\"s1\"><strong>\u6355\u83b7\u76d1\u542c\u4e8b\u4ef6<\/strong><span class=\"s2\"><br \/>\n<span class=\"Apple-converted-space\">\u00a0capture-bind:tap=&#8221;click&#8221; \u66ff\u6362\u4e3a\u00a0<span class=\"s3\">@tap.capture<span class=\"s2\">=&#8221;click&#8221;\uff0c<br \/>\n<span class=\"s1\"><strong>\u4e2d\u65ad\u6355\u83b7\u76d1\u542c<\/strong><span class=\"s2\"><br \/>\ncapture-catch:tap=\u201cclick&#8221;\u66ff\u6362\u4e3a\u00a0<span class=\"s3\">@tap.capture.stop<span class=\"s2\">=&#8221;click&#8221;\u3002<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p><strong>Taro\u00a0<\/strong>\u5143\u7d20\u7684\u4e8b\u4ef6\u5904\u7406\u548c DOM \u5143\u7d20\u7684\u5f88\u76f8\u4f3c\u3002\u4f46\u662f\u6709\u4e00\u70b9\u8bed\u6cd5\u4e0a\u7684\u4e0d\u540c:<\/p>\n<p>Taro \u4e8b\u4ef6\u7ed1\u5b9a\u5c5e\u6027\u7684\u547d\u540d\u91c7\u7528\u9a7c\u5cf0\u5f0f\u5199\u6cd5\uff0c\u800c\u4e0d\u662f\u5c0f\u5199\u3002 \u5982\u679c\u91c7\u7528 JSX \u7684\u8bed\u6cd5\u4f60\u9700\u8981\u4f20\u5165\u4e00\u4e2a\u51fd\u6570\u4f5c\u4e3a\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff0c\u800c\u4e0d\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32 (DOM \u5143\u7d20\u7684\u5199\u6cd5)\u3002 \u4f8b\u5982\uff0c\u4f20\u7edf\u7684\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6a21\u677f\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<pre>&lt;button onclick=\"activateLasers\"&gt;\r\n  Activate Lasers\r\n&lt;\/button&gt;<\/pre>\n<\/div>\n<p>Taro \u4e2d\u7a0d\u7a0d\u6709\u70b9\u4e0d\u540c\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<pre>&lt;button onClick={this.activateLasers}&gt;\r\n  Activate Lasers\r\n&lt;\/button&gt;<\/pre>\n<\/div>\n<p>\u5728 Taro \u4e2d\u53e6\u4e00\u4e2a\u4e0d\u540c\u662f\u4f60\u4e0d\u80fd\u4f7f\u7528\u00a0<code>catchEvent<\/code>\u00a0\u7684\u65b9\u5f0f\u963b\u6b62\u4e8b\u4ef6\u5192\u6ce1\u3002\u4f60\u5fc5\u987b\u660e\u786e\u7684\u4f7f\u7528\u00a0<code>stopPropagation<\/code>\u3002<\/p>\n<h2><strong>\u00a0request\u8bf7\u6c42<\/strong><\/h2>\n<pre><strong>wepy<\/strong>\u5bf9wx.request\u505a\u4e86\u63a5\u53d7\u53c2\u6570\u7684\u4fee\u6539,\u503c\u5f97\u4e00\u63d0\u7684\u662f\u5b83\u63d0\u4f9b\u4e86\u9488\u5bf9\u5168\u5c40\u7684intercapter\u62e6\u622a\u5668<\/pre>\n<div class=\"cnblogs_code\">\n<pre>\/\/ \u539f\u751f\u4ee3\u7801:\r\n\r\nwx.request({\r\n    url: 'xxx',\r\n    success: function (data) {\r\n        console.log(data);\r\n    }\r\n});\r\n\r\n\/\/ WePY \u4f7f\u7528\u65b9\u5f0f, \u9700\u8981\u5f00\u542f Promise \u652f\u6301\uff0c\u53c2\u8003\u5f00\u53d1\u89c4\u8303\u7ae0\u8282\r\nwepy.request('xxxx').then((d) =&gt; console.log(d));\r\n\r\n\/\/ async\/await \u7684\u4f7f\u7528\u65b9\u5f0f, \u9700\u8981\u5f00\u542f Promise \u548c async\/await \u652f\u6301\uff0c\u53c2\u8003 WIKI\r\nasync function request () {\r\n   let d = await wepy.request('xxxxx');\r\n   console.log(d);\r\n}<\/pre>\n<\/div>\n<p>\u62e6\u622a\u5668<\/p>\n<div class=\"cnblogs_code\">\n<pre>import wepy from 'wepy';\r\n\r\nexport default class extends wepy.app {\r\n    constructor () {\r\n        \/\/ this is not allowed before super()\r\n        super();\r\n        \/\/ \u62e6\u622arequest\u8bf7\u6c42\r\n        this.intercept('request', {\r\n            \/\/ \u53d1\u51fa\u8bf7\u6c42\u65f6\u7684\u56de\u8c03\u51fd\u6570\r\n            config (p) {\r\n                \/\/ \u5bf9\u6240\u6709request\u8bf7\u6c42\u4e2d\u7684OBJECT\u53c2\u6570\u5bf9\u8c61\u7edf\u4e00\u9644\u52a0\u65f6\u95f4\u6233\u5c5e\u6027\r\n                p.timestamp = +new Date();\r\n                console.log('config request: ', p);\r\n                \/\/ \u5fc5\u987b\u8fd4\u56deOBJECT\u53c2\u6570\u5bf9\u8c61\uff0c\u5426\u5219\u65e0\u6cd5\u53d1\u9001\u8bf7\u6c42\u5230\u670d\u52a1\u7aef\r\n                return p;\r\n            },\r\n\r\n            \/\/ \u8bf7\u6c42\u6210\u529f\u540e\u7684\u56de\u8c03\u51fd\u6570\r\n            success (p) {\r\n                \/\/ \u53ef\u4ee5\u5728\u8fd9\u91cc\u5bf9\u6536\u5230\u7684\u54cd\u5e94\u6570\u636e\u5bf9\u8c61\u8fdb\u884c\u52a0\u5de5\u5904\u7406\r\n                console.log('request success: ', p);\r\n                \/\/ \u5fc5\u987b\u8fd4\u56de\u54cd\u5e94\u6570\u636e\u5bf9\u8c61\uff0c\u5426\u5219\u540e\u7eed\u65e0\u6cd5\u5bf9\u54cd\u5e94\u6570\u636e\u8fdb\u884c\u5904\u7406\r\n                return p;\r\n            },\r\n\r\n            \/\/\u8bf7\u6c42\u5931\u8d25\u540e\u7684\u56de\u8c03\u51fd\u6570\r\n            fail (p) {\r\n                console.log('request fail: ', p);\r\n                \/\/ \u5fc5\u987b\u8fd4\u56de\u54cd\u5e94\u6570\u636e\u5bf9\u8c61\uff0c\u5426\u5219\u540e\u7eed\u65e0\u6cd5\u5bf9\u54cd\u5e94\u6570\u636e\u8fdb\u884c\u5904\u7406\r\n                return p;\r\n            },\r\n\r\n            \/\/ \u8bf7\u6c42\u5b8c\u6210\u65f6\u7684\u56de\u8c03\u51fd\u6570(\u8bf7\u6c42\u6210\u529f\u6216\u5931\u8d25\u90fd\u4f1a\u88ab\u6267\u884c)\r\n            complete (p) {\r\n                console.log('request complete: ', p);\r\n            }\r\n        });\r\n    }\r\n}<\/pre>\n<\/div>\n<p><strong>taro\u5bf9request\u8fdb\u884c\u4e86\u4e8c\u6b21\u5c01\u88c5,\u53ef\u4ee5\u4f7f\u7528<\/strong>Taro.request(OBJECT)\u53d1\u8d77\u7f51\u7edc\u8bf7\u6c42\uff0c\u652f\u6301\u00a0<code>Promise<\/code>\u00a0\u5316\u4f7f\u7528\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-2510\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/1055667-20181018120017403-1425410190.png\" alt=\"1055667-20181018120017403-1425410190\" width=\"984\" height=\"706\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/1055667-20181018120017403-1425410190.png 1578w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/03\/1055667-20181018120017403-1425410190-140x100.png 140w\" sizes=\"(max-width: 984px) 100vw, 984px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/img2018.cnblogs.com\/blog\/1055667\/201810\/1055667-20181018123449801-1254521172.png\" alt=\"\" width=\"991\" height=\"439\" \/><\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<pre>import Taro from '@tarojs\/taro'\r\n\r\nTaro.request({\r\n  url: 'http:\/\/localhost:8080\/test',\r\n  data: {\r\n    foo: 'foo',\r\n    bar: 10\r\n  },\r\n  header: {\r\n    'content-type': 'application\/json'\r\n  }\r\n})\r\n  .then(res =&gt; console.log(res.data))<\/pre>\n<div class=\"cnblogs_code_toolbar\"><\/div>\n<\/div>\n<p><strong>mpvue<\/strong>\u6ca1\u6709\u5bf9request\u505a\u7279\u6b8a\u4f18\u5316,\u4e0e\u539f\u751f\u76f8\u540c,\u53ef\u4ee5\u81ea\u5df1\u6839\u636e\u9700\u8981\u8fdb\u884c\u5c01\u88c5<\/p>\n<h2>\u72b6\u6001\u7ba1\u7406<\/h2>\n<p><strong>wepy<\/strong>\u00a0\u53ef\u5f15\u7528Redux\u548cMbox,\u76ee\u524dwepy\u7684\u811a\u624b\u67b6\u5185\u5df2\u7ecf\u96c6\u6210\u4e86redux,\u9009\u62e9\u9700\u8981\u5373\u53ef;<\/p>\n<p><strong>mpVue<\/strong>\u4f7f\u7528vuex<\/p>\n<p><strong>taro<\/strong>\u4f7f\u7528Redux<\/p>\n<h2>\u5982\u4f55\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u9879\u76ee<\/h2>\n<ul>\n<li>\u5982\u679c\u53ea\u9700\u8981\u505a\u4e00\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5219\u6839\u636e\u81ea\u5df1\u7684\u64c5\u957f\u6846\u67b6\u9009\u62e9mpvue\u6216taro<\/li>\n<li>\u5982\u679c\u662f\u5f53\u524d\u8001\u9879\u76ee\u60f3\u50cf\u5411\u7a0b\u5e8f\u8fc1\u79fb\u540c\u65f6\u8001\u9879\u76ee\u53c8\u662f\u4f7f\u7528vue\u5f00\u53d1,\u5efa\u8bae\u4f7f\u7528mpvue\u6216wepy<\/li>\n<li>\u5982\u679c\u662f\u8001\u9879\u76ee\u4f7f\u7528react\u5f00\u53d1\u4e14\u9700\u8981\u90e8\u5206\u8fc1\u79fb\u5c0f\u7a0b\u5e8f,\u5efa\u8bae\u4f7f\u7528taro<\/li>\n<li>\u5982\u679c\u662f\u65b0\u9879\u76ee\u4e14\u65b0\u9879\u76ee\u9700\u8981\u540c\u65f6\u652f\u6301\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f, \u5efa\u8bae\u4f7f\u7528\u539f\u751f\u5f00\u53d1,\u56e0\u4e3a\u76ee\u524d\u6846\u67b6\u7684\u8f6c\u8bd1\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u652f\u6301\u5e76\u4e0d\u662f\u5f88\u597d,\u4e14\u51fa\u4e86\u95ee\u9898\u4e0d\u597d\u5b9a\u4f4d\u4fee\u6539, \u4f46\u5982\u679c\u662f\u5c0fdemo\u4e0d\u6d89\u53ca\u592a\u591a\u903b\u8f91\u7684\u9879\u76ee\u90fd\u53ef\u4ee5\u4f7f\u7528\u6846\u67b6\u4f5c\u4e3a\u5c1d\u9c9c; \u4f46\u5982\u679c\u662f\u6d89\u53ca\u592a\u591a\u4ea4\u4e92\u903b\u8f91\u7684\u5219\u4e0d\u5efa\u8bae\u4f7f\u7528\u6846\u67b6\u8f6c\u8bd1,\u7531\u4e8e\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u5728\u89c6\u56fe\u5c42\u57fa\u672c\u4e0e\u5c0f\u7a0b\u5e8f\u4e00\u81f4\u6240\u4ee5\u5efa\u8bae\u624b\u52a8\u66f4\u6539\u66ff\u6362\u90e8\u5206\u65b9\u6cd5\u548c\u5168\u5c40\u66ff\u6362\u4e00\u4e9b\u5c5e\u6027\u6216\u6587\u4ef6\u540d,\u5982wxml\u66ff\u6362\u4e3aaxml\u8fd9\u79cd, \u624b\u52a8\u8f6c\u6362\u65f6\u95f4\u6bd4\u5927\u6982\u662f\u56db\u6bd4\u4e00; \u5f53\u7136\u5982\u679c\u4eba\u624b\u8db3\u591f\u4e00\u7aef\u5f00\u53d1\u4e00\u4e2a\u662f\u6700\u597d\u7684..<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u539f\u6587\uff1a<a href=\"https:\/\/www.cnblogs.com\/Smiled\/p\/9806781.html\">https:\/\/www.cnblogs.com\/Smiled\/p\/9806781.html<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 \u00a0\u4f17\u6240\u5468\u77e5\u5982\u4eca\u5e02\u9762\u4e0a\u7aef\u7684\u5f62\u6001\u591a\u79cd\u591a\u6837\uff0c\u624b\u673aWeb\u3001ReactNative\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f, \u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[105,112],"tags":[116],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2504"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2504"}],"version-history":[{"count":5,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2504\/revisions"}],"predecessor-version":[{"id":2513,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2504\/revisions\/2513"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}