1. 程式人生 > 其它 >uni-app修改favicon.ico

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>