参考https://blog.csdn.net/weixin_45633422/article/details/115019629和https://teech-lab.com/vue-js-vscode-settings/1041/
列表如下
(1)? Project name (VueTest002):项目名称name can no longer contain capital letters(不能大写)
(2)? Project description (A Vue.js project) vue-cli新建项目(项目描述);
(3)? Author (xhdx <zhuming3834@sina.com>) ;zhuming3834@sina.com(项目作者);
(4)? Vue build
❯ Runtime + Compiler: recommended for most users
Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY
allowed in .vue files - render functions are required elsewhere
这里选择Runtime + Compiler: recommended for most users;
(5)? Install vue-router? (Y/n) y 是否使用vue-router,这里根据需求选择;
(6)? Use ESLint to lint your code? (Y/n) y 是否使用ESLint,这里根据需求选择;
(7)? Pick an ESLint preset (Use arrow keys)
❯ Standard (https://github.com/feross/standard)
Airbnb (https://github.com/airbnb/javascript) none (configure it yourself)
这里选择 Standard(https://github.com/feross/standard)
(8)? Setup unit tests with Karma + Mocha? (Y/n) n 是否需要单元测试,这里根据需求选择;
(9)Setup e2e tests with Nightwatch? (Y/n) n是否需要单元测试,这里根据需求选择;
(10) Should we run `npm install` for you after the project has been created?
(recommended) (Use arrow keys)
创建项目后需要需要安装项目所需要的依赖,这里选择no,本步骤作为步骤6说明
-S
即--save(保存)
包名会被注册在package.json的dependencies里面,在生产环境下这个包的依赖依然存在
-D
即--dev(生产)
包名会被注册在package.json的devDependencies里面,仅在开发环境下存在的包用-D,如babel,sass-loader这些解析器
啥也不写
包名不会进入package.json里面,因此别人不知道你安装了这个包
npm install -d 就是 npm install --save-dev 安装到开发环境 例如 gulp ,babel,webpack 一般都是辅助工具
npm insatll -s 就是npm install --save 安装到生产环境 如 vue ,react 等
//修改src\main.js
import {createApp} from 'vue';
import ElementPlus from 'element-plus'; //需要加入的代码
import App from './App.vue';
import "element-plus/dist/index.css"; //需要加入的代码
let app = createApp(App);
app.use(ElementPlus); //需要加入的代码
app.mount('#app');
//修改src\App.vue
<template>
<img alt="Vue logo" src="./assets/logo.png">
<el-table :data="[]"></el-table>
<el-button type="success">测试按钮</el-button>
</template>