Vue.js 网页端项目(仿今日头条)(一)
项目背景介绍
项目视频链接:最新 Vue.js 后台管理系统项目实战(今日头条)_哔哩哔哩_bilibili
(一)项目初始化
1.使用 vue cli 创建项目
打开 vs code 在命令行输入
1 vue --version
如果出现 @vue/cli 4.5.13(这里是我自己的版本) 说明已安装;
否则输入安装/升级命令:
1 npm intall --global @vue/cli
至此,vue cli 脚手架已经安装完成。
输入一下命令创建项目:toutiao-publish-admin(我取的名字)
1 vue create toutiao-publish-admin
1 Vue CLI v4.5.13 2 ? Please pick a preset: (Use arrow keys) 3 > test ([Vue 2] less, babel, router, vuex) 4 Default ([Vue 2] babel, eslint) 5 Default (Vue 3) ([Vue 3] babel, eslint) 6 Manually select features 选择手动进行配置
1 Vue CLI v4.5.13 2 ? Please pick a preset: Manually select features 3 ? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection) 4 >(*) Choose Vue version 5 (*) Babel es6转成es5 6 ( ) TypeScript 7 ( ) Progressive Web App (PWA) Support 8 (*) Router 路由 9 ( ) Vuex 10 (*) CSS Pre-processors less sass处理工具 11 ( ) Linter / Formatter 校验代码规范,教程里选了,但我闲代码操作有问题这里没选 12 ( ) Unit Testing 13 ( ) E2E Testing
1 Vue CLI v4.5.13 2 ? Please pick a preset: Manually select features 3 ? Check the features needed for your project: Choose Vue version, Babel, Router, CSS Pre-processors 4 ? Choose a version of Vue.js that you want to start the project with (Use arrow keys) 5 > 2.x 选择vue2 6 3.x
1 ? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) n 是否使用history模式,兼容性不太好,这里不适用
1 ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): 2 Sass/SCSS (with dart-sass) 3 Sass/SCSS (with node-sass) 4 > Less 选择less 5 Stylus
1 ? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys) 配置信息放在哪里 2 > In dedicated config files 专门配置文件,查看维护的时候更加方便 3 In package.json
装包环节--------------------------------------------
根据命令提示
1 $ cd toutiao-publish-admin 2 $ npm run serve
项目创建成功!
浙公网安备 33010602011771号