您的位置:首页 > Web前端 > Vue.js

使用webpack快速搭建Vue前端项目

2020-02-08 02:57 856 查看

**

使用webpack快速搭建Vue前端项目:

**
第一步:
首先确认本地已经安装了node.js(链接:nodejs下载
第二步:
1、打开本地命令行:输入CMD
2、安装vue-cli脚手架工具

npm install -g vue-cli

3、开始初始化要构建的项目
(projectname 是你要构建的项目包名称)

vue init webpack projectname

执行上面构建指令过程中,要依次输入一些项目基本信息:

Project name testproject //这里输入项目名称:testproject
Project description  this is a test project//这里输入项目描述信息:this is a test project
Author  learner-ls//项目作者信息:learner-ls
Vue build  standalone  //vue项目构建  运行+编译 或 仅运行(这里选择仅运行即可)
Install vue-router? Yes //是否安装vue-router(vue的路由插件),选yes
Use ESLint to lint your code? No  //是否使用ESLint
Set up unit tests No  //是否使用单元测试
Setup e2e tests with Nighttwatch? NO  //是否适用Nighttwatch e2e测试
Shoud we run 'npm install' for you after the project has been created?(recommended)npm vue-cli Generated "testproject"  //是否在项目创建成功后自动执行“npm install”依赖

具体执行情况如下图:

4、运行创建好的项目

cd testproject
npm run dev

执行上述指令后。在浏览器中输入http://localhost:8080,页面显示如下:

  • 点赞
  • 收藏
  • 分享
  • 文章举报
代码小小生 发布了3 篇原创文章 · 获赞 0 · 访问量 133 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: