<\/figure>\n<\/p>\n\u653e\u7f6e\u5728id\u4e3aapp\u7684div\u4e2d\uff0c\u5e76\u5728cordova.js\u548capp.js\u6587\u4ef6\u4e2d\u52a0\u8f7dCordova\u548cVue\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u5728app.js\u6587\u4ef6\u4e2d\u521d\u59cb\u5316Vue\u5e94\u7528\u7a0b\u5e8f\u5e76\u5b9a\u4e49\u8def\u7531\u548c\u7ec4\u4ef6\uff1a<\/p>\n
“`<\/p>\n
import Vue from ‘vue’<\/p>\n
import App from ‘.\/App.vue’<\/p>\n
import router from ‘.\/router’<\/p>\n
Vue.config.productionTip = false<\/p>\n
new Vue({<\/p>\n
router,<\/p>\n
render: h => h(App)<\/p>\n
}).$mount(‘#app’)<\/p>\n
“`<\/p>\n
\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5bfc\u5165Vue\u548cApp\u7ec4\u4ef6\uff0c\u5e76\u4f7f\u7528vue-router\u5b9a\u4e49\u8def\u7531\u3002\u7136\u540e\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2aVue\u5b9e\u4f8b\uff0c\u5e76\u5c06\u8def\u7531\u548cApp\u7ec4\u4ef6\u4f20\u9012\u7ed9\u5b83\u3002<\/p>\n
\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u5728config.xml\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e9b\u914d\u7f6e\uff0c\u4ee5\u4fbf\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u8bbf\u95ee\u8bbe\u5907\u529f\u80fd\uff1a<\/p>\n
“`<\/p>\n
\n
MyApp<\/p>\n
A Cordova Vue App<\/p>\n
Your Name<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n
“`<\/p>\n
\u5728\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u540d\u79f0\u3001\u63cf\u8ff0\u3001\u4f5c\u8005\u548c\u5165\u53e3\u70b9\u3002\u6211\u4eec\u8fd8\u5b9a\u4e49\u4e86\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u8bbf\u95ee\u7684\u8bbe\u5907\u529f\u80fd\uff0c\u5982\u76f8\u673a\u3001\u8054\u7cfb\u4eba\u548c\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n
\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efa\u548c\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n
“`<\/p>\n
npm run build<\/p>\n
cordova run android<\/p>\n
“`<\/p>\n
\u8fd9\u5c06\u6784\u5efaVue\u5e94\u7528\u7a0b\u5e8f\u5e76\u5c06\u5176\u5d4c\u5165\u5230Cordova\u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002\u7136\u540e\uff0c\u5b83\u5c06\u5728\u8fde\u63a5\u7684Android\u8bbe\u5907\u4e0a\u8fd0\u884c\u3002<\/p>\n
\u603b\u4e4b\uff0cVue\u548cCordova\u7684\u7ed3\u5408\u53ef\u4ee5\u8ba9\u60a8\u4f7f\u7528Vue\u7684\u7ec4\u4ef6\u5316\u67b6\u6784\u548c\u54cd\u5e94\u5f0f\u6570\u636e\u7ed1\u5b9a\u6765\u6784\u5efa\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002\u4f7f\u7528Vue\u548cCordova\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95ee\u8bbe\u5907\u786c\u4ef6\u548c\u64cd\u4f5c\u7cfb\u7edf\u529f\u80fd\uff0c\u5e76\u5728\u591a\u4e2a\u5e73\u53f0\u4e0a\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Vue\u662f\u4e00\u79cd\u6d41\u884c\u7684JavaScript\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u5355\u9875\u9762\u5e94\u7528\u7a0b\u5e8f\uff08SPA\uff09\u548c\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002Vue\u53ef\u4ee5\u4e0eCordova\u6216Ionic\u7b49\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u521b\u5efa\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[23505,23504,12,904,736],"topic":[],"class_list":["post-22051","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-vue-app","tag-webapp","tag-12","tag-904","tag-736"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/22051","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\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=22051"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/22051\/revisions"}],"predecessor-version":[{"id":22134,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/22051\/revisions\/22134"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=22051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=22051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=22051"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=22051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}