一.静态配置vue项目ico
1.1将需要展示的ico放到项目文件中
1.2在项目跟目录中的index.html添加如下代码
//href路径为ico路径,此代码所指向是项目根目录下的favicon.ico
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
二.动态配置网站ico
//动态设置就在拿到数据之后调用这个方法
getCreate(url){
var link= document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'ico文件的url'
document.getElementsByTagName('head')[0].appendChild(link);
},