环境搭建
1.1 Visual Studio Code 插件搭建本地服务器
在VScode扩展中搜索Live Server并下载。
1.2 Node.js 搭建本地服务器
1.2.1 官网下载npm并安装
https://nodejs.org/en/download/
1.2.2 在终端输入npm install http-server -g
后面是更新信息,不用管他。
1.2.3 用VScode打开文件
1.2.4 打开.html文件
方法一
在index.html文件上右键,点击Open with Live Server
方法二(教程方法)
在终端使用http-server . -p 8000
打开如下网站Ctrl+鼠标左键
Ctrl+C
返回终端