{"id":2353,"date":"2017-11-28T11:36:06","date_gmt":"2017-11-28T03:36:06","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2353"},"modified":"2017-11-28T11:36:06","modified_gmt":"2017-11-28T03:36:06","slug":"spa%e7%ae%a1%e7%90%86%e6%a1%86%e6%9e%b6-miox-%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2353","title":{"rendered":"SPA\u7ba1\u7406\u6846\u67b6 Miox \u6559\u7a0b"},"content":{"rendered":"<p>\n\t<a href=\"https:\/\/github.com\/51nb\/miox\" name=\"miox\" target=\"_blank\" title=\"miox\">Miox<\/a> \u662f\u4e00\u4e2aSPA\u7ba1\u7406\u6846\u67b6\u3002\u6839\u636e github \u4e0a\u5f00\u6e90\u4fe1\u606f\u663e\u793a\uff0c\u5e94\u8be5\u662f\u6765\u81ea51\u4fe1\u7528\u5361\u56e2\u961f\u7684\u5f00\u6e90\u4ea7\u54c1\u3002\u672c\u6587\u4ecb\u7ecd&nbsp;Miox \u7684\u4f7f\u7528\u6559\u7a0b\u3002\n<\/p>\n<p>\n\t\u5728\u7ecf\u5178\u7684\u7f51\u9875\u5f00\u53d1\u4e2d\uff0c\u6d4f\u89c8\u5668\u521b\u5efa\u548c\u7ba1\u7406\u4e00\u7cfb\u5217\u7f51\u9875\u751f\u547d\u5468\u671f\u6d3b\u52a8\uff0c\u5982\u4f1a\u8bdd\u5386\u53f2\uff0c\u9875\u9762\u521b\u5efa\uff0c\u4e22\u5f03\uff0c\u9875\u9762\u5c55\u793a\uff0c\u9875\u9762\u9690\u85cf\u7b49\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5728\u8fd9\u4e9b\u6d3b\u52a8\u4e0a\u5904\u7406\u81ea\u5df1\u7684\u903b\u8f91\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"miox\" src=\"https:\/\/camo.githubusercontent.com\/b84205f585cef64f7ef70b52e6ecf26c74d9c4ce\/687474703a2f2f3778746a32322e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f6d696f782d313230783132302e737667\" style=\"width: 152px;height: 150px\" \/>\n<\/p>\n<p>\n\t\u5728SPA\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u5f00\u53d1\u4eba\u5458\u5fc5\u987b\u81ea\u5df1\u5904\u7406\u6240\u6709\u8fd9\u4e9b\u4e8b\u4ef6\uff0c\u6216\u8005\u7531\u4e00\u4e2a\u5904\u7406\u8fd9\u4e9b\u4e8b\u4ef6\u7684\u6846\u67b6\u6765\u5904\u7406\u3002Miox\u662f\u53e6\u4e00\u4e2a\u6846\u67b6\u4e0e\u4ed6\u4eec\u4ea4\u6613\u3002\n<\/p>\n<ul>\n<li>\n\t\t<font><font>Miox\u7279\u522b\u7684\u5730\u65b9\u5728\u4e8e\u5b83\u652f\u6301\u4efb\u4f55\u6e32\u67d3\u6838\u5fc3\uff0c\u8fd9\u610f\u5473\u7740\u4e0eMiox\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u540c\u65f6\u5c06Miox\u5f15\u5165\u5230\u4ed6\u4eec\u7684\u9879\u76ee\u4e2d\uff0c\u5e76\u7559\u4e0b\u4ed6\u6700\u559c\u6b22\u7684\u53cd\u5e94\u6216vue\u3002<\/font><\/font>\n\t<\/li>\n<li>\n\t\t<font><font>Miox\u4e13\u6ce8\u4e8e\u4f5c\u4e3a\u4e00\u4e2aSPA\u8fd0\u884c\u65f6\u95f4\uff0c\u5177\u6709\u5982\u6b64\u6709\u9650\u7684\u5c0f\u76ee\u6807\uff0c\u5b83\u5f00\u53d1\u4e86\u80fd\u591f\u8f7b\u677e\u96c6\u6210\u6700\u57fa\u672c\u7684\u6280\u672f\uff0c\u5305\u62ecredux \/ vuex\uff0cSSR\u7b49\u3002<\/font><\/font>\n\t<\/li>\n<\/ul>\n<p>\n\t<font><font>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c51\u4fe1\u7528\u5361\u51e0\u4e4e\u6240\u6709\u7684\u7f51\u7edc\u524d\u7aef\u9879\u76ee\u90fd\u662f\u5728PC\u548c\u79fb\u52a8\u7aef\u90fd\u4f7f\u7528Miox\u4f5c\u4e3aSPA\u6846\u67b6\uff0c\u8fd9\u610f\u5473\u7740Miox\u5df2\u7ecf\u5728\u751f\u4ea7\u4e2d\u5f97\u5230\u4e86\u5e7f\u6cdb\u7684\u4f7f\u7528\u548c\u6d4b\u8bd5\u3002<\/font><\/font>\n<\/p>\n<h2>\n\t<font><font>Miox\u7684\u7279\u70b9<\/font><\/font><br \/>\n<\/h2>\n<ul>\n<li>\n\t\t\u8f7b\u91cf\uff1a\u7a7a\u9879\u76ee\u6253\u5305\u4f53\u79ef170K+\uff0cMiox\u4ec5\u6253\u5305\u4f53\u79ef40K+\uff0c\u8f7b\u91cf\u7684\u4f53\u79ef\u5927\u5c0f\u5b8c\u6210\u66f4\u591a\u7684\u903b\u8f91\u3002\n\t<\/li>\n<li>\n\t\t\u9ad8\u6548\uff1a\u57fa\u4e8e\u5c3d\u53ef\u80fd\u6700\u5927\u9650\u5ea6\u590d\u7528\u9875\u9762\u7684\u539f\u5219\uff0c\u91c7\u7528\u7f13\u5b58\u7b97\u6cd5\u4f18\u5316\u6027\u80fd\u3002\n\t<\/li>\n<li>\n\t\t\u7a33\u5b9a\uff1a\u4ee3\u7801\u8986\u76d6\u7387\u8fbe\u523090%\uff0c\u57fa\u672c\u8986\u76d6\u6240\u6709\u573a\u666f\uff0c\u7a33\u5b9a\u9879\u76ee\u8fd0\u884c\u3002\n\t<\/li>\n<li>\n\t\t\u5f3a\u5927\uff1aMiox\u63d0\u4f9b\u5f3a\u5927\u7684\u63d2\u4ef6\u652f\u6301\uff0c\u6ee1\u8db3\u7528\u6237\u591a\u53d8\u7684\u9700\u6c42\u3002\u65b9\u4fbf\u7684\u6269\u5c55API\u63a5\u53e3\uff0c\u968f\u5fc3\u6240\u6b32\u9a7e\u9a6d\u6574\u4e2a\u9879\u76ee\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t\u4e0b\u9762\u6211\u4eec\u770b\u770bMiox\u7684\u547d\u4ee4\u884c\u5b89\u88c5\uff0c\u521b\u5efa\uff0c\u5e94\u7528\u5b89\u88c5\uff0c\u8fd0\u884c\u6848\u4f8b\uff0c\u548c\u6784\u5efa\u6848\u4f8b\u7684\u547d\u4ee4\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nnpm install miox-cli -g\r\nmiox create\r\nnpm install\r\nnpm run dev\r\nnpm run build<\/pre>\n<p>\n\t\u76f8\u5173\u4ee3\u7801\u53ef\u4ee5\u4ece<a href=\"https:\/\/github.com\/51nb\/miox\" name=\"miox\" target=\"_blank\" title=\"miox\">https:\/\/github.com\/51nb\/miox<\/a>\u4e0a\u514b\u9686\u3002\n<\/p>\n<h2>\n\t\u57fa\u672c\u7528\u6cd5<br \/>\n<\/h2>\n<p>\n\tindex.js \u662f\u6211\u4eec\u9879\u76ee\u7684\u5165\u53e3\u3002\u52a0\u5165\u5982\u4e0b\u4ee3\u7801\uff1a\n<\/p>\n<pre class=\"brush:jscript;\">\r\nimport Miox from &#039;miox&#039;;\r\nimport Engine from &#039;miox-react&#039;;\r\nimport router from &#039;.\/route&#039;;\r\n\r\nconst app = new Miox({...options});\r\napp.install(Engine);\r\napp.use(router.routes());\r\nexport default app.listen();<\/pre>\n<p>\n\troute.js\uff1a\u8def\u7531\u6587\u4ef6\u3002\n<\/p>\n<pre class=\"brush:jscript;\">\r\nimport Router from &#039;miox-router&#039;;\r\nimport Page from &#039;.\/page.jsx&#039;;\r\n\r\nconst route = new Router();\r\nexport default route;\r\nroute.patch(&#039;\/&#039;, async ctx =&gt; {\r\n  await ctx.render(Page);\r\n});<\/pre>\n<p>\n\tpage.jsx\uff1a\u5448\u73b0webview\u6587\u4ef6\u3002\n<\/p>\n<pre class=\"brush:jscript;\">\r\nimport React from &#039;react&#039;;\r\nimport ReactDOM from &#039;react-dom&#039;;\r\nexport default class ExamplePage extends React.Component {\r\n  render() {\r\n    return &lt;h1&gt;Hello World!&lt;\/h1&gt;;\r\n  }\r\n}<\/pre>\n<p>\n\t\u8fd0\u884c\u524d\u9762\u7684\u547d\u4ee4\uff0c<font>\u5c06\u5448\u73b0&ldquo;Hello World\uff01&rdquo;&nbsp;<\/font><font>\u5230\u9875\u9762\u4e0a\u7684\u4e00\u4e2a\u5bb9\u5668\u4e2d\u3002<\/font>\n<\/p>\n<h2>\n\t<font>Miox\u5b89\u88c5<\/font><br \/>\n<\/h2>\n<p>\n\t<font><font>Miox\u4f5c\u4e3a<\/font><\/font><a href=\"https:\/\/www.npmjs.com\/\" rel=\"nofollow\"><font><font>npm<\/font><\/font><\/a><font><font>\u4e0a\u7684miox\u8f6f\u4ef6\u5305\u63d0\u4f9b<\/font><font>\u3002<\/font><\/font>\n<\/p>\n<p>\n\t<font><font>\u6211\u4eec\u63d0\u4f9b\u4e00\u4e2a\u811a\u624b\u67b6\u6765\u4fc3\u8fdb\u9879\u76ee\u7684\u5b89\u88c5\u3002<\/font><font>\u4e00\u65e6\u9879\u76ee\u5b89\u88c5\u5b8c\u6bd5\uff0c\u60a8\u5c31\u53ef\u4ee5\u5f00\u59cb\u7f16\u5199\u4e1a\u52a1\u903b\u8f91\u4e86\u3002<\/font><\/font>\n<\/p>\n<p>\n\t<font><font>\u5b89\u88c5miox-cli\u521b\u5efa\u9879\u76ee\uff1a<\/font><\/font>\n<\/p>\n<pre class=\"brush:bash;\">\r\nnpm install -g miox-cli<\/pre>\n<p>\n\t<font><font>\u7136\u540e\u8fd0\u884cmiox create\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\u7684\u4ee3\u7801\uff1a<\/font><\/font>\n<\/p>\n<pre class=\"brush:bash;\">\r\nmiox create<\/pre>\n<p>\n\t\u66f4\u591a\u5b66\u4e60\u8d44\u6599\uff0c\u8bf7\u53c2\u8003\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/github.com\/51nb\/miox\" name=\"miox\" target=\"_blank\" title=\"miox\">https:\/\/github.com\/51nb\/miox<\/a>\u3002<\/p>\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=2353\">SPA\u7ba1\u7406\u6846\u67b6 Miox \u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Miox \u662f\u4e00\u4e2aSPA\u7ba1\u7406\u6846\u67b6\u3002\u6839\u636e github \u4e0a\u5f00\u6e90\u4fe1\u606f\u663e\u793a\uff0c\u5e94\u8be5\u662f\u6765\u81ea51\u4fe1\u7528\u5361\u56e2\u961f\u7684\u5f00\u6e90\u4ea7\u54c1\u3002\u672c\u6587\u4ecb [&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":[1437,1106,1433,1584],"class_list":["post-2353","post","type-post","status-publish","format-standard","hentry","category-html5","tag-github","tag-javascript","tag-npm","tag-spa"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2353","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=2353"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2353\/revisions"}],"predecessor-version":[{"id":2362,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2353\/revisions\/2362"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}