{"id":37,"date":"2023-07-13T13:04:56","date_gmt":"2023-07-13T05:04:56","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/37\/"},"modified":"2023-07-13T13:04:56","modified_gmt":"2023-07-13T05:04:56","slug":"vue%e9%a1%b9%e7%9b%ae%e6%89%93%e5%8c%85%e8%8b%b9%e6%9e%9capp%e6%8e%a8%e8%8d%90%e4%b8%80%e9%97%a8%e6%89%93%e5%8c%85%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/37\/","title":{"rendered":"vue\u9879\u76ee\u6253\u5305\u82f9\u679capp\u63a8\u8350\u4e00\u95e8\u6253\u5305\u5e73\u53f0"},"content":{"rendered":"

Vue\u662f\u4e00\u79cd\u6d41\u884c\u7684\u524d\u7aefJavaScript\u6846\u67b6\uff0c\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u6784\u5efa\u73b0\u4ee3\u3001\u54cd\u5e94\u5f0f\u7684\u7528\u6237\u754c\u9762\u3002Vue\u9879\u76ee\u901a\u5e38\u8fd0\u884c\u5728Web\u6d4f\u89c8\u5668\u4e0a\uff0c\u4f46\u6709\u65f6\u5019\u6211\u4eec\u53ef\u80fd\u5e0c\u671b\u5c06Vue\u9879\u76ee\u6253\u5305\u6210\u539f\u751f\u7684iOS\u5e94\u7528\uff0c\u4ee5\u4fbf\u5728\u82f9\u679c\u8bbe\u5907\u4e0a\u4f7f\u7528\u3002<\/p>\n

\u8981\u5c06Vue\u9879\u76ee\u6253\u5305\u6210\u82f9\u679cApp\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Cordova\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u6784\u5efa\u6df7\u5408\u79fb\u52a8\u5e94\u7528\u7684\u6d41\u884c\u82f9\u679capp\u6253\u5305<\/a>\u6846\u67b6\u3002\u4e0b\u9762\u6211\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u4e00\u4e0b\u5177\u4f53\u7684\u6b65\u9aa4\uff1a<\/p>\n

1. \u5b89\u88c5Cordova\uff1a<\/p>\n

\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86Node.js\u548cnpm\u3002\u7136\u540e\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Cordova\uff1a<\/p>\n

“`<\/p>\n

npm install -g cordova<\/p>\n

“`<\/p>\n

2. \u521b\u5efaCordova\u9879\u76ee\uff1a<\/p>\n

\u5728\u7ec8\u7aef\u4e2d\uff0c\u8fdb\u5165\u60a8\u7684Vue\u9879\u76ee\u7684\u6839\u76ee\u5f55\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efaCordova\u9879\u76ee\uff1a<\/p>\n

“`<\/p>\n

cordova create app_name<\/p>\n

“`<\/p>\n

3. \u6dfb\u52a0iOS\u5e73\u53f0\uff1a<\/p>\n

\u8fdb\u5165Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6dfb\u52a0iOS\u5e73\u53f0\uff1a<\/p>\n

“`<\/p>\n

cordova platform add ios<\/p>\n

“`<\/p>\n

4. \u6784\u5efaVue\u9879\u76ee\u7684\u751f\u4ea7\u7248\u672c\uff1a<\/p>\n

\u5728\u7ec8\u7aef\u4e2d\uff0c\u8fdb\u82f9\u679capp\u6253\u5305app\u5f00\u53d1\u6e90\u7801<\/a>\u5165\u60a8\u7684Vue\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efa\u751f\u4ea7\u7248\u672c\u7684Vue\u9879\u76ee\uff1a<\/p>\n

“`<\/p>\n

npm run build<\/p>\n

“`<\/p>\n

5. \u590d\u5236Vue\u9879\u76ee\u7684\u6784\u5efa\u6587\u4ef6\uff1a<\/p>\n

\u5728Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a`www`\u7684\u6587\u4ef6\u5939\u3002\u7136\u540e\uff0c\u5c06Vue\u9879\u76ee\u6784\u5efa\u547d\u4ee4\u751f\u6210\u7684\u6587\u4ef6\u590d\u5236\u5230`www`\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n

6. \u914d\u7f6eCordova\u5e94\u7528\uff1a<\/p>\n

\u5728Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\uff0c\u6253\u5f00\u540d\u4e3a`config.xml`\u7684\u6587\u4ef6\uff0c\u5e76\u6839\u636e\u60a8\u7684\u5e94\u7528\u9700\u6c42\u8fdb\u884c\u914d\u7f6e\u3002\u81f3\u5c11\uff0c\u60a8\u9700\u8981\u4e3a\u5e94\u7528\u8bbe\u7f6e\u4e00\u4e2a\u552f\u4e00\u7684`id`\u548c`name`\u3002<\/p>\n

7. \u5c06Vue\u9879\u76ee\u7684\u5165\u53e3HTML\u6587\u4ef6\u5f15\u5165Cordova\u5e94\u7528\uff1a<\/p>\n

\u5728<\/p>\n

<\/figure>\n<\/p>\n

Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\uff0c\u6253\u5f00\u540d\u4e3a`www\/index.html`\u7684\u6587\u4ef6\u3002\u5c06Vue\u9879\u76ee\u6784\u5efa\u547d\u4ee4\u751f\u6210\u7684`index.html`\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u590d\u5236\u5230`www\/index.html`\u6587\u4ef6\u4e2d\u3002<\/p>\n

8. \u6784\u5efaCordova\u5e94\u7528\uff1a<\/p>\n

\u5728\u7ec8\u7aef\u4e2d\uff0c\u8fdb\u5165Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efaiOS\u5e94\u7528\uff1a<\/p>\n

“`<\/p>\n

cordova build ios<\/p>\n

“`<\/p>\n

9. \u5728Xcode\u4e2d\u8fd0\u884c\u5e94\u7528\uff1a<\/p>\n

\u6253\u5f00Cordova\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u7684`platforms\/ios`\u6587\u4ef6\u5939\uff0c\u60a8\u5c06\u627e\u5230\u4e00\u4e2a\u540d\u4e3a`app_name.xcworkspace`\u7684\u6587\u4ef6\u3002\u53cc\u51fb\u5b83\uff0c\u5c06\u5e94\u7528\u7a0b\u5e8f\u52a0\u8f7d\u5230Xcode\u4e2d\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u6a21\u62df\u5668\u6216\u5b9e\u9645\u8bbe\u5907\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u4ee5\u4e0a\u5c31\u662f\u628aVue\u9879\u76ee\u6253\u5305\u6210\u82f9\u679cApp\u7684\u8be6\u7ec6\u6b65\u9aa4\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u53ea\u662f\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c\u8fd8\u6709\u5176\u4ed6\u65b9\u6cd5\u4e5f\u53ef\u4ee5\u8fbe\u5230\u76f8\u540c\u7684\u76ee\u6807\u3002\u540c\u65f6\uff0c\u8fd8\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6253\u5305\u6210\u539f\u751fiOS\u5e94\u7528\u4f1a\u5f15\u5165\u4e00\u4e9b\u4e0eWeb\u73af\u5883\u4e0d\u540c\u7684\u9650\u5236\u548c\u7279\u6027\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u6839\u636e\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u989d\u5916\u7684\u8c03\u6574\u548c\u4f18\u5316\u3002<\/p>\n

\u5e0c\u671b\u8fd9\u4e2a\u4ecb\u7ecd\u80fd\u591f\u5e2e\u52a9\u5230\u60a8\uff0c\u795d\u60a8\u6210\u529f\u6253\u5305\u60a8\u7684Vue\u9879\u76ee\u6210\u82f9\u679cApp\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

Vue\u662f\u4e00\u79cd\u6d41\u884c\u7684\u524d\u7aefJavaScript\u6846\u67b6\uff0c\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u6784\u5efa\u73b0\u4ee3\u3001\u54cd\u5e94\u5f0f\u7684\u7528\u6237\u754c\u9762\u3002Vue\u9879\u76ee\u901a\u5e38\u8fd0\u884c\u5728Web\u6d4f\u89c8\u5668\u4e0a\uff0c\u4f46\u6709\u65f6\u5019\u6211\u4eec\u53ef\u80fd\u5e0c\u671b\u5c06Vue\u9879\u76ee\u6253\u5305\u6210\u539f\u751f\u7684iOS\u5e94\u7528\uff0c\u4ee5\u4fbf\u5728\u82f9\u679c\u8bbe\u5907\u4e0a\u4f7f<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[63,16,62,61,23],"topic":[],"class_list":{"0":"post-37","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-appkf","7":"tag-app","8":"tag-16","9":"tag-62","11":"tag-23"},"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=37"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}