将图标文件放在本地项目static\images文件夹下
修改index.html代码如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>测试</title>
<link rel="shortcut icon" type="image/x-icon" href="./static/images/favicon.ico">
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
核心代码
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
效果展示