{"id":2381,"date":"2017-12-01T16:25:59","date_gmt":"2017-12-01T08:25:59","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2381"},"modified":"2017-12-01T16:25:59","modified_gmt":"2017-12-01T08:25:59","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%bb%84%e4%bb%b6%e5%8c%96%e5%bc%80%e5%8f%91%e6%a1%86%e6%9e%b6-wepy-%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2381","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6 wepy \u6559\u7a0b"},"content":{"rendered":"<p>\n\t<a href=\"https:\/\/tencent.github.io\/wepy\/\" name=\"wepy\" target=\"_blank\" title=\"wepy\">wepy<\/a> \u662f\u817e\u8baf\u5f00\u6e90\u7684\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6\u3002\u5728\u5f00\u6e90\u4ee5\u6765\u6df1\u53d7\u5e7f\u5927\u5f00\u53d1\u8005\u559c\u7231\uff0c\u76ee\u524d\u5df2\u6709\u8d85\u8fc7 1500 \u4f4d\u5f00\u53d1\u8005\u4f7f\u7528\u6216\u4e86\u89e3\u672c\u6846\u67b6, \u62e5\u6709\u4f17\u591a\u7684\u5f00\u53d1\u7279\u6027\u548c\u4f18\u5316\u65b9\u6848\u3002\u4e3a\u6b64\u6211\u51c6\u5907\u4e86\u8fd9\u7bc7\u6559\u7a0b\uff0c\u5e0c\u671b\u80fd\u8ba9\u5927\u5bb6\u66f4\u5feb\u7684\u4e0a\u624b&nbsp;<a href=\"https:\/\/tencent.github.io\/wepy\/\" name=\"wepy\" target=\"_blank\" title=\"wepy\">wepy<\/a>\u3002\n<\/p>\n<h2>\n\t\u4ecb\u7ecd<br \/>\n<\/h2>\n<p>\n\tWePY \u662f\u4e00\u6b3e\u8ba9\u5c0f\u7a0b\u5e8f\u652f\u6301\u7ec4\u4ef6\u5316\u5f00\u53d1\u7684\u6846\u67b6\uff0c\u901a\u8fc7\u9884\u7f16\u8bd1\u7684\u624b\u6bb5\u8ba9\u5f00\u53d1\u8005\u53ef\u4ee5\u9009\u62e9\u81ea\u5df1\u559c\u6b22\u7684\u5f00\u53d1\u98ce\u683c\u53bb\u5f00\u53d1\u5c0f\u7a0b\u5e8f\u3002\u6846\u67b6\u7684\u7ec6\u8282\u4f18\u5316\uff0cPromise\uff0cAsync Functions\u7684\u5f15\u5165\u90fd\u662f\u4e3a\u4e86\u80fd\u8ba9\u5f00\u53d1\u5c0f\u7a0b\u5e8f\u9879\u76ee\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\uff0c\u9ad8\u6548\u3002\n<\/p>\n<p>\n\t\u540c\u65f6WePY\u4e5f\u662f\u4e00\u6b3e\u6210\u957f\u4e2d\u7684\u6846\u67b6\uff0c\u5927\u91cf\u5438\u6536\u501f\u9274\u4e86\u4e00\u4e9b\u4f18\u5316\u524d\u7aef\u5de5\u5177\u4ee5\u53ca\u6846\u67b6\u7684\u8bbe\u8ba1\u7406\u5ff5\u548c\u601d\u60f3\u3002\n<\/p>\n<h2>\n\t\u7279\u6027<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t\u7c7bVue\u5f00\u53d1\u98ce\u683c\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u5f00\u53d1\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u5f15\u5165NPM\u5305\n\t<\/li>\n<li>\n\t\t\u652f\u6301<a href=\"https:\/\/github.com\/wepyjs\/wepy\/wiki\/wepy%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8Promise\">Promise<\/a>\n\t<\/li>\n<li>\n\t\t\u652f\u6301ES2015+\u7279\u6027\uff0c\u5982<a href=\"https:\/\/github.com\/wepyjs\/wepy\/wiki\/wepy%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8async-await\">Async Functions<\/a>\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u591a\u79cd\u7f16\u8bd1\u5668\uff0cLess\/Sass\/Styus\u3001Babel\/Typescript\u3001Pug\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u591a\u79cd\u63d2\u4ef6\u5904\u7406\uff0c\u6587\u4ef6\u538b\u7f29\uff0c\u56fe\u7247\u538b\u7f29\uff0c\u5185\u5bb9\u66ff\u6362\u7b49\n\t<\/li>\n<li>\n\t\t\u652f\u6301 Sourcemap\uff0cESLint\u7b49\n\t<\/li>\n<li>\n\t\t\u5c0f\u7a0b\u5e8f\u7ec6\u8282\u4f18\u5316\uff0c\u5982\u8bf7\u6c42\u5217\u961f\uff0c\u4e8b\u4ef6\u4f18\u5316\u7b49\n\t<\/li>\n<\/ul>\n<p>\n\tWePY \u6846\u67b6\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u53c2\u8003\u4e86 Vue \u7b49\u73b0\u6709\u6846\u67b6\u7684\u4e00\u4e9b\u8bed\u6cd5\u98ce\u683c\u548c\u529f\u80fd\u7279\u6027\uff0c\u5bf9\u539f\u751f\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u6a21\u5f0f\u8fdb\u884c\u4e86\u518d\u6b21\u5c01\u88c5\uff0c\u66f4\u8d34\u8fd1\u4e8e MVVM \u67b6\u6784\u6a21\u5f0f, \u5e76\u652f\u6301ES6\/7\u7684\u4e00\u4e9b\u65b0\u7279\u6027\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 WePY \u524d\u540e\u7684\u4ee3\u7801\u5bf9\u6bd4\u4e0e\u7ec4\u4ef6\u5316\u793a\u4f8b\u3002\n<\/p>\n<h2>\n\t\u5b89\u88c5<br \/>\n<\/h2>\n<p>\n\t\u5b89\u88c5\uff08\u66f4\u65b0\uff09 wepy \u547d\u4ee4\u884c\u5de5\u5177\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nnpm install wepy-cli -g<\/pre>\n<p>\n\t\u751f\u6210\u5f00\u53d1\u5b9e\u4f8b\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nwepy new myproject<\/pre>\n<p>\n\t\u5b9e\u65f6\u7f16\u8bd1\u5f00\u53d1\u9879\u76ee\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nwepy build --watch<\/pre>\n<h2>\n\t\u5f00\u53d1\u8005\u5de5\u5177\u4f7f\u7528<br \/>\n<\/h2>\n<p>\n\t\u914d\u5408\u5f00\u53d1\u5de5\u5177\u7684\u4f7f\u7528\u6709\u4ee5\u4e0b5\u4e2a\u6b65\u9aa4\uff1a\n<\/p>\n<ol>\n<li>\n\t\t\u4f7f\u7528\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u65b0\u5efa\u9879\u76ee\uff0c\u672c\u5730\u5f00\u53d1\u9009\u62e9dist\u76ee\u5f55\u3002\n\t<\/li>\n<li>\n\t\t\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177&#8211;&gt;\u9879\u76ee&#8211;&gt;\u5173\u95edES6\u8f6cES5\u3002\u91cd\u8981\uff1a\u6f0f\u6389\u6b64\u9879\u4f1a\u8fd0\u884c\u62a5\u9519\u3002\n\t<\/li>\n<li>\n\t\t\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177&#8211;&gt;\u9879\u76ee&#8211;&gt;\u5173\u95ed\u4e0a\u4f20\u4ee3\u7801\u65f6\u6837\u5f0f\u81ea\u52a8\u8865\u5168 \u91cd\u8981\uff1a\u67d0\u4e9b\u60c5\u51b5\u4e0b\u6f0f\u6389\u6b64\u9879\u4f1a\u4e5f\u4f1a\u8fd0\u884c\u62a5\u9519\u3002\n\t<\/li>\n<li>\n\t\t\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177&#8211;&gt;\u9879\u76ee&#8211;&gt;\u5173\u95ed\u4ee3\u7801\u538b\u7f29\u4e0a\u4f20 \u91cd\u8981\uff1a\u5f00\u542f\u540e\uff0c\u4f1a\u5bfc\u81f4\u771f\u673acomputed, props.sync \u7b49\u7b49\u5c5e\u6027\u5931\u6548\u3002\n\t<\/li>\n<li>\n\t\t\u9879\u76ee\u6839\u76ee\u5f55\u8fd0\u884cwepy build &#8211;watch\uff0c\u5f00\u542f\u5b9e\u65f6\u7f16\u8bd1\u3002\n\t<\/li>\n<\/ol>\n<h2>\n\t\u6848\u4f8b<br \/>\n<\/h2>\n<p>\n\t\u4ecb\u7ecd\u4e86\u4e0a\u9762\u7684\u51c6\u5907\u5de5\u4f5c\u540e\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a&nbsp;Hello World \u6848\u4f8b\u3002\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;style lang=&quot;less&quot;&gt;\r\n    @color: #4D926F;\r\n    .userinfo {\r\n        color: @color;\r\n    }\r\n&lt;\/style&gt;\r\n&lt;template lang=&quot;pug&quot;&gt;\r\n    view(class=&#039;container&#039;)\r\n        view(class=&#039;userinfo&#039; @tap=&#039;tap&#039;)\r\n            mycom(:prop.sync=&#039;myprop&#039; @fn.user=&#039;myevent&#039;)\r\n            text {{now}}\r\n&lt;\/template&gt;\r\n&lt;script&gt;\r\n    import wepy from &#039;wepy&#039;;\r\n    import mycom from &#039;..\/components\/mycom&#039;;\r\n    export default class Index extends wepy.page {\r\n        components = { mycom };\r\n        data = {\r\n            myprop: {}\r\n        };\r\n        computed = {\r\n            now () { return +new Date(); }\r\n        };\r\n        async onLoad() {\r\n            await sleep(3);\r\n            console.log(&#039;Hello World&#039;);\r\n        }\r\n        sleep(time) {\r\n            return new Promise((resolve, reject) =&gt; setTimeout(() =&gt; resolve, time * 1000));\r\n        }\r\n    }\r\n&lt;\/script&gt;<\/pre>\n<p>\n\t\u8fd0\u884c\u6548\u679c\u6211\u5c31\u4e0d\u8d34\u4e86\uff0c\u66f4\u591a\u5b66\u4e60\u8d44\u6599\u53c2\u8003\u5b98\u65b9\u6587\u6863\u3002\n<\/p>\n<h2>\n\t\u53c2\u8003\u8d44\u6599<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/tencent.github.io\/wepy\/\" name=\"\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6\" target=\"_blank\" title=\"\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6\">\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/github.com\/aben1188\/awesome-wepy\" name=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6wepy\u5f00\u53d1\u8d44\u6e90\u6c47\u603b\" target=\"_blank\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6wepy\u5f00\u53d1\u8d44\u6e90\u6c47\u603b\">\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6wepy\u5f00\u53d1\u8d44\u6e90\u6c47\u603b<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2381\">\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6 wepy \u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>wepy \u662f\u817e\u8baf\u5f00\u6e90\u7684\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6\u3002\u5728\u5f00\u6e90\u4ee5\u6765\u6df1\u53d7\u5e7f\u5927\u5f00\u53d1\u8005\u559c\u7231\uff0c\u76ee\u524d\u5df2\u6709\u8d85\u8fc7 1500 \u4f4d\u5f00\u53d1\u8005 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1106,1588,444,445,1432],"class_list":["post-2381","post","type-post","status-publish","format-standard","hentry","category-html5","tag-javascript","tag-1588","tag-444","tag-445","tag-1432"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2381"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2381\/revisions"}],"predecessor-version":[{"id":2382,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2381\/revisions\/2382"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}