uniapp添加网站favicon文件
生活随笔
收集整理的這篇文章主要介紹了
uniapp添加网站favicon文件
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前言
uniapp 默認(rèn)創(chuàng)建的項(xiàng)目并沒有給我們提供加上網(wǎng)站 favicon 的 ”機(jī)會”,但其實(shí)官方已經(jīng)給出解決方法了,使用的是 自定義模板
自定義模板的場景,通常有以下幾種情況:
如上,使用 自定義模板 肯定是滿足我們解決添加 favicon 的了,看一下怎么用吧。
1、工程跟項(xiàng)目新建一個(gè) XXX.html 文件,文件名字自己定義,比如 template.html
2、復(fù)制基本模板內(nèi)容到這個(gè)html文件,在此基礎(chǔ)上修改meta和引入js;
<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>
????????????document.addEventListener('DOMContentLoaded',?function()?{
????????????????document.documentElement.style.fontSize?=?document.documentElement.clientWidth?/?20?+?'px'
????????????})
????????</script>
????????<link?rel="stylesheet"?href="<%=?BASE_URL?%>static/index.<%=?VUE_APP_INDEX_CSS_HASH?%>.css"?/>
????</head>
????<body>
????????<noscript>
????????????<strong>Please?enable?JavaScript?to?continue.</strong>
????????</noscript>
????????<div?id="app"></div>
????????<!--?built?files?will?be?auto?injected?-->
????</body>
</html>
3、這 head 中加入我們的 favicon 文件
<link?rel="icon"?type="image/png"?sizes="32x32"?href="http://img.sscai.club/favicon1.png”>4、在 manifest.json -> h5 -> template 節(jié)點(diǎn)中關(guān)聯(lián)這個(gè)html文件的路徑。
ok,運(yùn)行下項(xiàng)目我肯可以看到已經(jīng)添加好了。
綜上,關(guān)于三種場景的使用方式可以自行擴(kuò)展了,比如增加百度統(tǒng)計(jì)代碼 > uniapp增加百度統(tǒng)計(jì)代碼(h5)
最后
博客地址:https://www.cnblogs.com/niceyoo
求關(guān)注??,求推薦👍,如果覺得這篇文章有點(diǎn)東西,不妨左上角關(guān)注一下我。
總結(jié)
以上是生活随笔為你收集整理的uniapp添加网站favicon文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Redis学习笔记1-Redis数据类型
- 下一篇: 游戏开发-从零开始 002