1. 创建项目
首先先检查vue-cli版本,必须是4.5.0以上才可以创建vue3.0项目 `vue --version`
创建项目命令 vue create zhihu 其中zhihu是项目名
----- 选择 Manually select features (手动选择)
----- 出现Check the features needed for your project:界面,勾选上TypeScript(采用空格勾选)。 (router和vuex暂时不添加。可以后续手动导入)
----- Choose a version of Vue.js that you want to start the project with 选择3版本
----- Use class-style component syntax? No
----- Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? 是否同时使用ts和babel 。目前只用ts, 所以选中No
----- Pick a linter / formatter config 我选择的是ESLint + Standard config。你可以自由选择
----- Pick additional lint features 我选择 Lint on save
----- Where do you prefer placing config for Babel, ESLint, etc.? 我选择In dedicated config files,在单独的文件中写这些配置文件。
----- Save this as a preset for future projects? No
回车后开始创建项目了。创建后的项目结构,我还新建了一些文件夹和文件,供日后项目使用。