-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcordova.html
More file actions
51 lines (47 loc) · 12.1 KB
/
cordova.html
File metadata and controls
51 lines (47 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Cordova - 黑猫的博客</title><meta name="description" content="版本:12 https://cordova.apache.org/docs/en/12.x/guide/overview/index.html Node JDK 11 npm install -g cordova 使用 创建项目 cordova create project-name com.example.hello HelloWorld 平台 添加平台 支持平台: cordova platform add android 检查平台前置环境是否满足 cordova…"><meta name="generator" content="Publii Open-Source CMS for Static Site"><link rel="stylesheet" href="https://yoru-hiru.github.io/media/plugins/mermaidSupport/mermaid-invert-filter.css"><meta name="theme-color" content="#17181E" media="(prefers-color-scheme: dark)"><meta name="theme-color" content="#D73A42" media="(prefers-color-scheme: light)"><meta name="msapplication-navbutton-color" content="#D73A42"><meta name="apple-mobile-web-app-status-bar-style" content="#D73A42"><link rel="canonical" href="https://yoru-hiru.github.io/cordova.html"><link rel="alternate" type="application/atom+xml" href="https://yoru-hiru.github.io/feed.xml" title="黑猫的博客 - RSS"><link rel="alternate" type="application/json" href="https://yoru-hiru.github.io/feed.json" title="黑猫的博客 - JSON"><meta property="og:title" content="Cordova"><meta property="og:image" content="https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-1.png"><meta property="og:image:width" content="2048"><meta property="og:image:height" content="2048"><meta property="og:site_name" content="黑猫的博客"><meta property="og:description" content="版本:12 https://cordova.apache.org/docs/en/12.x/guide/overview/index.html Node JDK 11 npm install -g cordova 使用 创建项目 cordova create project-name com.example.hello HelloWorld 平台 添加平台 支持平台: cordova platform add android 检查平台前置环境是否满足 cordova…"><meta property="og:url" content="https://yoru-hiru.github.io/cordova.html"><meta property="og:type" content="article"><link rel="stylesheet" href="https://yoru-hiru.github.io/assets/css/beer.min.css?v=97db26e7a78b1c9d5963eb444324035e"><script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.13.0/dist/cdn/beer.min.js"></script><link rel="stylesheet" href="https://yoru-hiru.github.io/assets/css/simpleMindMap.esm.css?v=e83c53a7321f68ca325b311007790260"><script src="https://yoru-hiru.github.io/assets/js/simpleMindMap.umd.min.js?v=353ab3936b0fb51ccc5bcd71fa090bad"></script><link rel="stylesheet" href="https://yoru-hiru.github.io/assets/css/style.css?v=a0a2fad1453b9945567bc3907ed7148b"><script type="application/ld+json">{"@context":"http://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://yoru-hiru.github.io/cordova.html"},"headline":"Cordova","datePublished":"2024-09-01T00:23+08:00","dateModified":"2024-09-02T18:23+08:00","image":{"@type":"ImageObject","url":"https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-1.png","height":2048,"width":2048},"description":"版本:12 https://cordova.apache.org/docs/en/12.x/guide/overview/index.html Node JDK 11 npm install -g cordova 使用 创建项目 cordova create project-name com.example.hello HelloWorld 平台 添加平台 支持平台: cordova platform add android 检查平台前置环境是否满足 cordova…","author":{"@type":"Person","name":"黑猫","url":"https://yoru-hiru.github.io/authors/hei-mao-xian-sheng/"},"publisher":{"@type":"Organization","name":"黑猫","logo":{"@type":"ImageObject","url":"https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-1.png","height":2048,"width":2048}}}</script></head><body class="dark finisher-header"><header><a id="logo" href="https://yoru-hiru.github.io/"><img src="https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-1.png" alt="黑猫的博客"></a><li><a href="">档案</a></li><li><a href="https://yoru-hiru.github.io/bi-ji.html">笔记</a></li><li><a href="">作品</a></li></header><main><article><header><h1>Cordova</h1><time datetime="2024-09-01T00:23">9月 1日 2024 </time>By <a href="https://yoru-hiru.github.io/authors/hei-mao-xian-sheng/" rel="author" title="黑猫">黑猫</a> Updated on: <time datetime="2024-09-02T18:23">9月 2日 2024</time></header><div id="post-entry"><div class="post__toc"><h3>目录</h3><ul><li><a href="#mcetoc_1i6kqfohifr">概述</a></li><li><a href="#mcetoc_1i6kbqu1ag">获取</a><ul><li><a href="#mcetoc_1i6kbqu1ah">前置环境</a></li><li><a href="#mcetoc_1i6kjftk8o">安装</a></li></ul></li><li><a href="#mcetoc_1i6kbqu1ai">使用</a><ul><li><a href="#mcetoc_1i6kjkavr16">创建项目</a></li><li><a href="#mcetoc_1i6kjkavr17">平台</a><ul><li><a href="#mcetoc_1i6kjqj2p1b">添加平台</a></li><li><a href="#mcetoc_1i6kjqj2p1c">检查平台前置环境是否满足</a></li><li><a href="#mcetoc_1i6kpqhqueb">定制</a></li></ul></li><li><a href="#mcetoc_1i6kpqhquec">插件</a><ul><li><a href="#mcetoc_1i6kpqhqued">添加插件</a></li><li><a href="#mcetoc_1i6kpqhquee">查询已安装插件</a></li><li><a href="#mcetoc_1i6kq4mmnev">社区插件</a></li></ul></li><li><a href="#mcetoc_1i6kk5acj20">构建</a></li><li><a href="#mcetoc_1i6km2ldk4g">测试</a><ul><li><a href="#mcetoc_1i6km2ldk4h">模拟器测试</a></li><li><a href="#mcetoc_1i6km2ldk4i">真机测试</a></li></ul></li><li><a href="#mcetoc_1i6kqdet7fl">版本管理</a></li></ul></li><li><a href="#mcetoc_1i6kpqhquef">更新</a><ul><li><a href="#mcetoc_1i6kpqhqueg">查看当前版本</a></li><li><a href="#mcetoc_1i6kpqhqueh">查看新版本</a></li><li><a href="#mcetoc_1i6kpqhquei">本体更新</a></li><li><a href="#mcetoc_1i6kpqhquej">平台更新</a></li></ul></li><li><a href="#mcetoc_1i6kqc627fb">定制</a><ul><li><a href="#mcetoc_1i6kqc627fc">钩子</a></li><li><a href="#mcetoc_1i6m2mg7h3">插件</a></li></ul></li></ul></div><p> </p><p>版本:12</p><hr><h2 id="mcetoc_1i6kqfohifr">概述</h2><p>https://cordova.apache.org/docs/en/12.x/guide/overview/index.html</p><h2 id="mcetoc_1i6kbqu1ag">获取</h2><h3 id="mcetoc_1i6kbqu1ah">前置环境</h3><p>Node</p><p>JDK 11</p><h3 id="mcetoc_1i6kjftk8o">安装</h3><pre class="language-bash"><code>npm install -g cordova</code></pre><h2 id="mcetoc_1i6kbqu1ai">使用</h2><h3 id="mcetoc_1i6kjkavr16">创建项目</h3><pre class="language-bash"><code>cordova create project-name com.example.hello HelloWorld</code></pre><h3 id="mcetoc_1i6kjkavr17">平台</h3><h4 id="mcetoc_1i6kjqj2p1b">添加平台</h4><p>支持平台:</p><ul><li>browser</li><li>android</li><li>ios</li><li>electron</li></ul><pre class="language-bash"><code>cordova platform add android</code></pre><h4 id="mcetoc_1i6kjqj2p1c">检查平台前置环境是否满足</h4><pre class="language-bash"><code> cordova requirements</code></pre><pre class="language-bash"><code>cordova platform ls</code></pre><h4 id="mcetoc_1i6kpqhqueb">定制</h4><h5>应用图标</h5><p>https://cordova.apache.org/docs/en/12.x/config_ref/images.html</p><p>config.xml 中</p><pre class="language-html"><code> <icon src="res/android/icon.png" platform="android" width="57" height="57" density="mdpi" /></code></pre><table style="border-collapse: collapse; width: 100%;" border="1"><tbody><tr><td style="width: 49.9526%;">density</td><td style="width: 49.9526%;"> </td></tr><tr><td style="width: 49.9526%;">target</td><td style="width: 49.9526%;"> </td></tr></tbody></table><h5>启动画面</h5><p>https://cordova.apache.org/docs/en/12.x/core/features/splashscreen/index.html</p><h3 id="mcetoc_1i6kpqhquec">插件</h3><p>访问原生能力需要用到插件,当然插件不止于这一能力。</p><h4 id="mcetoc_1i6kpqhqued">添加插件</h4><pre class="language-bash"><code>cordova plugin add plugin-name</code></pre><h4 id="mcetoc_1i6kpqhquee">查询已安装插件</h4><pre class="language-bash"><code>cordova plugin</code></pre><h4 id="mcetoc_1i6kq4mmnev"><a href="https://www.npmjs.com/search?q=keywords:ecosystem:cordova" target="_blank" rel="noopener noreferrer">社区插件</a></h4><h3 id="mcetoc_1i6kk5acj20">构建</h3><p>全平台构建:</p><pre class="language-bash"><code>cordova build</code></pre><p>特定平台构建:</p><pre class="language-bash"><code>cordova build platform-name</code></pre><h3 id="mcetoc_1i6km2ldk4g">测试</h3><h4 id="mcetoc_1i6km2ldk4h">模拟器测试</h4><p>重新构建并部署到模拟器:</p><pre class="language-bash"><code>cordova emulate </code></pre><p>特定模拟器测试:</p><pre class="language-bash"><code>cordova emulate android</code></pre><h4 id="mcetoc_1i6km2ldk4i">真机测试</h4><pre class="language-bash"><code>cordova run android</code></pre><h3 id="mcetoc_1i6kqdet7fl">版本管理</h3><p>https://cordova.apache.org/docs/en/12.x/platform_plugin_versioning_ref/index.html</p><h2 id="mcetoc_1i6kpqhquef">更新</h2><h3 id="mcetoc_1i6kpqhqueg">查看当前版本</h3><pre class="language-bash"><code>cordova -v</code></pre><h3 id="mcetoc_1i6kpqhqueh">查看新版本</h3><pre class="language-bash"><code>npm info cordova version</code></pre><h3 id="mcetoc_1i6kpqhquei">本体更新</h3><pre class="language-bash"><code>npm update -g cordova</code></pre><h3 id="mcetoc_1i6kpqhquej">平台更新</h3><pre class="language-bash"><code>cordova platform update platform-name --save</code></pre><h2>优化</h2><h3>性能</h3><p>meta 元素的视口属性值用 width=device-width,以此规避 300 毫秒点击延迟。</p><p>动画使用硬件加速的 CSS transitions ,而不是 JS 的 DOM 操作。</p><h2 id="mcetoc_1i6kqc627fb">定制</h2><h3 id="mcetoc_1i6kqc627fc">钩子</h3><p><a href="https://cordova.apache.org/docs/en/12.x/guide/appdev/hooks/index.html">https://cordova.apache.org/docs/en/12.x/guide/appdev/hooks/index.html</a></p><h3 id="mcetoc_1i6m2mg7h3">插件</h3><p>https://cordova.apache.org/docs/en/12.x/guide/hybrid/plugins/index.html</p></div><div id="author-bio"><img src="https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-2.png" loading="lazy" alt="黑猫" height="2048" width="2048"><h3><a href="https://yoru-hiru.github.io/authors/hei-mao-xian-sheng/" title="黑猫">黑猫</a></h3></div><nav id="post-navigation"><a href="https://yoru-hiru.github.io/framework7.html" rel="prev">← Previous (Framework7) </a><a href="https://yoru-hiru.github.io/zi-gua-ying.html" rel="next">Next (自适应) →</a></nav></article></main><aside><section><h3>Selected posts</h3><ul><li><a href="https://yoru-hiru.github.io/yong-hu-ti-yan.html">用户体验</a></li><li><a href="https://yoru-hiru.github.io/jie-mian.html">设计语言</a></li><li><a href="https://yoru-hiru.github.io/she-ji-token.html">设计 Token</a></li></ul></section><section><h3>Authors</h3><ul><li><a href="https://yoru-hiru.github.io/authors/hei-mao-xian-sheng/"><img src="https://yoru-hiru.github.io/media/website/Sheng-Cheng-Hei-Mao-2.png" loading="lazy" alt="黑猫" height="2048" width="2048"> </a><a href="https://yoru-hiru.github.io/authors/hei-mao-xian-sheng/">黑猫 <sup>26</sup></a></li></ul></section></aside><script>const mindMapLife = new window.simpleMindMap.default({
el: document.getElementById('mindMapContainerLife'),
data: {
"data": {
"text": "生活",
},
"children": [{
data: {
"text": "健康",
},
}
]
},
readonly: true,
});
const mindMapCareer = new window.simpleMindMap.default({
el: document.getElementById('mindMapContainerCareer'),
data: {
"data": {
"text": "事业",
},
"children": [{
data: {
"text": "健康",
},
data: {
"text": "情感",
},
}
]
},
readonly: true,
});
const mindMapContainerExplore = new window.simpleMindMap.default({
el: document.getElementById('mindMapContainerKnowledge'),
data: {
"data": {
"text": "学问",
},
"children": [{
data: {
"text": "健康",
},
}]
},
readonly: true,
});</script><script async src="https://yoru-hiru.github.io/assets/js/scripts.js?v=3733efd39cd6c799b95c8fcb96993840"></script><script src="https://yoru-hiru.github.io/media/plugins/mermaidSupport/mermaid.min.js"></script><script>mermaid.initialize({ startOnLoad: true, theme: "default" });</script></body></html>