利用app-info-parser插件前端解析ipa、apk安装包信息

      发布在:前端技术      评论:0 条评论
<p><span style="color: rgb(77, 77, 77); font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">利用app-info-parser插件前端解析ipa、apk安装包信息实现方式</span></p><pre style="background-color:#262e37;color:#ffffff;font-family:&#39;Consolas&#39;;font-size:11.3pt;"><span style="color:#5b7773;background-color:#191f26;">&lt;!-- html --&gt;</span><span style="color:#5b7773;"><br/></span>&lt;<span style="color:#c32867;font-weight:bold;">input </span><span style="color:#a6e22e;">type</span><span style="color:#e6db74;font-weight:bold;">=&quot;file&quot; </span><span style="color:#a6e22e;">name</span><span style="color:#e6db74;font-weight:bold;">=&quot;file&quot; </span><span style="color:#a6e22e;">id</span><span style="color:#e6db74;font-weight:bold;">=&quot;file&quot; </span><span style="color:#a6e22e;">οnchange</span><span style="color:#e6db74;font-weight:bold;">=&quot;fileSelect()&quot;</span>&gt;<br/>&lt;<span style="color:#c32867;font-weight:bold;">script </span><span style="color:#a6e22e;">src</span><span style="color:#e6db74;font-weight:bold;">=&quot;/dist/app-info-parser.min.js&quot;</span>&gt;&lt;/<span style="color:#c32867;font-weight:bold;">script</span>&gt;<br/>&lt;<span style="color:#c32867;font-weight:bold;">script</span>&gt;<br/> <span style="color:#f92672;">function </span><span style="font-style:italic;">fileSelect </span>() {<br/> <span style="color:#f92672;">const </span><span style="color:#64a2a2;">files </span><span style="color:#f92672;">= </span><span style="color:#660e7a;font-weight:bold;font-style:italic;">document</span>.<span style="color:#4ac60a;">getElementById</span>(<span style="color:#e6db74;">&#39;file&#39;</span>).<span style="color:#660e7a;font-weight:bold;">files</span>;<br/> <span style="color:#f92672;">const </span><span style="color:#64a2a2;">parser </span><span style="color:#f92672;">= new </span><span style="color:#660e7a;font-weight:bold;">AppInfoParser</span>(<span style="color:#64a2a2;">files</span>[<span style="color:#ae81ff;">0</span>]);<br/> <span style="color:#64a2a2;">parser</span>.<span style="color:#4ac60a;">parse</span>().<span style="color:#4ac60a;">then</span>(<span style="color:#fd971f;font-style:italic;">result </span><span style="color:#f92672;">=&gt; </span>{<br/><br/> <span style="color:#660e7a;font-weight:bold;font-style:italic;">console</span>.<span style="color:#4ac60a;">log</span>(<span style="color:#e6db74;">&#39;app info ----&gt; &#39;</span>, <span style="color:#fd971f;font-style:italic;">result</span>)<br/> <span style="color:#660e7a;font-weight:bold;">$</span>(<span style="color:#e6db74;">&#39;#loading </span><span style="color:#f92672;">img</span><span style="color:#e6db74;">&#39;</span>).<span style="color:#4ac60a;">attr</span>(<span style="color:#e6db74;">&#39;src&#39;</span>,<span style="color:#fd971f;font-style:italic;">result</span>.<span style="color:#660e7a;font-weight:bold;">icon</span>);<br/> <span style="color:#660e7a;font-weight:bold;">$</span>(<span style="color:#e6db74;">&#39;.</span><span style="color:#a6e22e;">loadend</span><span style="color:#e6db74;">&#39;</span>).<span style="color:#4ac60a;">text</span>(<span style="color:#fd971f;font-style:italic;">result</span>[<span style="color:#e6db74;">&#39;package&#39;</span>] <span style="color:#f92672;">|| </span><span style="color:#fd971f;font-style:italic;">result</span>[<span style="color:#e6db74;">&#39;CFBundleName&#39;</span>]);<br/> }).<span style="color:#4ac60a;">catch</span>(<span style="color:#fd971f;font-style:italic;">err </span><span style="color:#f92672;">=&gt; </span>{<br/> <span style="color:#660e7a;font-weight:bold;font-style:italic;">console</span>.<span style="color:#4ac60a;">log</span>(<span style="color:#e6db74;">&#39;err ----&gt; &#39;</span>, <span style="color:#fd971f;font-style:italic;">err</span>)<br/> })<br/> }<br/>&lt;/<span style="color:#c32867;font-weight:bold;">script</span>&gt;</pre><p><span style="color: rgb(77, 77, 77); font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"></span><br/></p><p><span style="color: rgb(77, 77, 77); font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">源码地址:</span><a href="https://links.jianshu.com/go?to=https%3A%2F%2Fgithub.com%2Fchenquincy%2Fapp-info-parser" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(103, 149, 181); text-decoration-line: none; cursor: pointer; font-family: &quot;Microsoft YaHei&quot;, &quot;SF Pro Display&quot;, Roboto, Noto, Arial, &quot;PingFang SC&quot;, sans-serif; overflow-wrap: break-word; font-size: 16px; white-space: normal; background-color: rgb(255, 255, 255);">https://github.com/chenquincy/app-info-parser</a></p><p>在线演示地址:<a href="https://app-info-parser.quincychen.cn/">https://app-info-parser.quincychen.cn/</a></p>
相关文章
热门推荐