uni-app修改favicon.ico


1.manifest.json文件

index.html文件(復制以下代碼到index.html內)。需要重新運行才能看到效果,本地和發布路徑不一樣,記得改過來

這里有個小技巧,新建一個uni-app項目的demo,里面會有一個template.h5.html文件(自動生成的),把那個文件內容復制過來就行了

<!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, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <title>
            <%= htmlWebpackPlugin.options.title %>
        </title>
        <!-- 正式發布的時候使用,開發期間不啟用。↓ -->
        <!-- <script src="/h5/touch-emulator.js"></script>
        <script>
            TouchEmulator();
            if (document.documentElement.clientWidth > 1024) {
                window.location.href = '/h5/pcguide.html#'+location.pathname+location.search;
            }
        </script>
        <style>
            ::-webkit-scrollbar{
                display: none;
            }
        </style>
        <script>
            var _hmt = _hmt || [];
            (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?";// 百度統計key
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script> -->
        <!-- 正式發布的時候使用,開發期間不啟用。↑ -->
        <script>
            // document.addEventListener('DOMContentLoaded', function() {
            //     document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
            // })
        </script>
    <!-- 線上發布的圖片路徑 -->
    <link rel="icon" type="image/png" sizes="16x16" href="/RFQ2020/static/images/favicon.ico>
    <!-- 本地運行的圖片路徑 -->
    <link rel="icon" type="image/png" sizes="16x16" href="../static/images/favicon.ico">
    
        <link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
    </head>
    <body>
        <!-- 該文件為 H5 平台的模板 HTML,並非應用入口。 -->
        <!-- 請勿在此文件編寫頁面代碼或直接運行此文件。 -->
        <!-- 詳見文檔:https://uniapp.dcloud.io/collocation/manifest?id=h5-template -->
        <noscript>
            <strong>Please enable JavaScript to continue.</strong>
        </noscript>
        <div id="app"></div>
        <!-- built files will be auto injected -->
        <script>
            /*BAIDU_STAT*/
        </script>
    </body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM