在控制台输入
node -v //检查node安装版本
npm -v //npm是node包管理工具
alt+shift+f 格式化全文 alt+k+f 格式化选中代码
File-->Preferences-->Settings
settings.json代码
"vetur.format.defaultFormatter.html": "js-beautify-html",
"emmet.includeLanguages": {
"wxml": "html"
},
"minapp-vscode.disableAutoConfig": true,
"explorer.confirmDelete": false,
"vetur.format.options.tabSize": 2,
"vetur.format.defaultFormatterOptions":{
"js-beautify-html":{
"wrap_attributes":"auto"
}
}
语法纠错,能检测代码语法问题、格式问题
alt+l+o(在文件上右击出现Open with Live Server选项,会自动打开浏览器)打开一个简单的web服务器,支持自动刷新,默认端口号5500
样式表自动补全功能
包含js常用语法关键字
包含html标签
vue create provue //provue为项目文件名
按↓选择Manually select features,手动配置
通过↑↓选择要配置的项,按空格是选中,a全选,i反选 我的选择
或者
? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>( ) Babel //转码器,可以将ES6代码转为ES5代码,从而在现有环境执行。
( ) TypeScript// TypeScript是一个JavaScript(后缀.js)的超集(后缀.ts)包含并扩展了 JavaScript 的语法,需要被编译输出为 JavaScript在浏览器运行
( ) Progressive Web App (PWA) Support// 渐进式Web应用程序
( ) Router // vue-router(vue路由)
( ) Vuex // vuex(vue的状态管理模式)
( ) CSS Pre-processors // CSS 预处理器(如:less、sass)
( ) Linter / Formatter // 代码风格检查和格式化(如:ESlint)
( ) Unit Testing // 单元测试(unit tests)
( ) E2E Testing // e2e(end to end) 测试
Vue-Router利用了浏览器自身的hash模式和history模式的特性来实现前端路由(通过调用浏览器提供的接口)
因公司原因选择less
node-sass是自动编译实时的,dart-sass需要保存后才会生效。sass官方目前主力推dart-sass,最新的特性都会在这个上面实现
提供一个插件化的JavaScript代码检测工具,ESLint+Prettier使用较多
建议选择保存就检测
( ) Lint on save // 保存就检测
( ) Lint and fix on commit // fix和commit时候检查
建议选择jest
Mocha + Chai //mocha灵活,只提供简单的测试结构,如果需要其他功能需要添加其他库/插件完成。必须在全局环境中安装
Jest //安装配置简单,容易上手。内置Istanbul,可以查看到测试覆盖率,相较于Mocha:配置简洁、测试代码简洁、易于和babel集成、内置丰富的expect
建议选择in package.json
In dedicated config files // 独立文件放置
In package.json // 放package.json里
如果是选择独立文件放置,项目会有.browserslistrc .eslintrc.js postcss.config.js文件单独在项目下
键入n不记录,如果键入y需要输入保存名字,下次配置时会出现保存名字 参考自https://www.cnblogs.com/sese/p/11712275.html
设置-->用户代码块,查找html.json
html.json代码
"print to console" : {
"prefix": "vue",
"body": [
" <div id=\"app\">",
" ",
" </div>",
"",
" <script>",
" const vm=new Vue({",
" el:'#app',",
" data:{},",
" methods:{}",
" });",
" </script>",
],
"description": "vue 's model"
}
在vs code中打开vue cli项目 File-->Add Filder to Workspace-->选择项目文件
安装
打开src下的.vue文件
打开vs code终端ctrl+`(view-->Terminal)
使用 npm 来安装
npm install view-design --save
本文章使用limfx的vscode插件快速发布