vue使用webpack脚手架
使用淘宝的npm 镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
1、全局安装webpack
npm install webpack -g
2、全局安装vue
npm install -g @vue/cli-init /cnpm install vue-cli -g //全局安装 vue-cli
3、初始化项目
vue init webpack
vue init webpack "项目名称"
? Project name //项目名称
? Project description A Vue.js project //项目描述,默认的
? Author *@qq.com //默认,回车即可
? Vue build (Use arrow keys) //默认,回车即可
? Vue build standalone //默认,回车即可
? Install vue-router? No //是否安装路由
? Use ESLint to lint your code? Yes //是否用ESLint来规范我们的代码
? Set up unit tests No //是否使用自动化的测试工具
? Setup e2e tests with Nightwatch? No //使用nightatch设置E2E测试
? Should we run npm install for you after the project has been created? (recommended) npm //选择npm安装
4、运行
npm run dev
5、打包
npm run build
6、项目架构index.html-->main.js-->App.vue-->index.js-->conponents组件
build--打包webpack相关
config--配置端口相关
node_modules--项目依赖
src--代码相关,main.js--主程序
static--静态资源、字体、图片
index.html--首页内容
package.json--依赖包的信息
7、elementUI安装main.js中引入
npm i element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
人生在于拼搏!!!

浙公网安备 33010602011771号