vue 使用vueCli 搭建vue2.x开发环境,并且指定ts 和less

nodejs 安装过程省略

设置淘宝镜像 永久使用

E:\front-workspace>npm config set registry https://registry.npmmirror.com

使用 npm 安装 cnpm(使用淘宝镜像)

npm install -g cnpm --registry=https://registry.npmmirror.com

或者使用官方淘宝镜像(两者都可以)

npm install -g cnpm --registry=https://registry.npm.taobao.org

安装VUE脚手架

E:\front-workspace>npm install -g @vue/cli

安装yarn 包管理器

E:\front-workspace>npm install -g yarn

added 1 package in 3s

查看客户端脚手架的版本

E:\front-workspace>vue --version

@vue/cli 5.0.9

创建 Vue 2.x 项目

使用 vue create 命令创建项目

vue create vue2-emall-web

在交互式界面中,您可以选择:

选择预设:

Default ([Vue 2] babel, eslint)

Default (Vue 3 Preview) ([Vue 3] babel, eslint)

Manually select features (手动选择功能)

如果选择手动选择,会出现以下选项:

? Check the features needed for your project:

?Choose Vue version

?Babel

?TypeScript

?Progressive Web App (PWA) Support

?Router

?Vuex

?CSS Pre-processors

?Linter / Formatter

?Unit Testing

?E2E Testing

使用键盘上最长的空格键 选择需要的某块

Vue CLI v5.0.9

? Please pick a preset: Manually select features

? Check the features needed for your project: Babel, TS, Router, Vuex, CSS Pre-processors, Linter

? Choose a version of Vue.js that you want to start the project with 2.x

? Use class-style component syntax? Yes

? Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? Yes

? Use history mode for router? (Requires proper server setup for index fallback in production) Yes

? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Less

? Pick a linter / formatter config: Standard

? 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? Yes

? Save preset as: vue2-emall-web

最后回车之后等待项目初始化完成

? Successfully created project vue2-emall-web.

? Get started with the following commands:

$ cd vue2-emall-web

$ npm run serve

使用 HBuilder x 开发工具打开项目文件夹加载项目之后

在客户终端命令行输入

npm run serve

显示如下内容说明启用成功

Note that the development build is not optimized.

To create a production build, run npm run build.

http://localhost:8080/ 浏览器访问 出现 VUE Welcome to Your Vue.js + TypeScript App 说明前段安装成功

相关推荐
白兰地空瓶1 小时前
🚀你以为你在写 React?其实你在“搭一套前端操作系统”
前端·react.js
爱上妖精的尾巴2 小时前
6-4 WPS JS宏 不重复随机取值应用
开发语言·前端·javascript
似水流年QC2 小时前
深入探索 WebHID:Web 标准下的硬件交互实现
前端·交互·webhid
陪我去看海2 小时前
测试 mcp
前端
speedoooo3 小时前
在现有App里嵌入一个AI协作者
前端·ui·小程序·前端框架·web app
全栈胖叔叔-瓜州3 小时前
关于llamasharp 大模型多轮对话,模型对话无法终止,或者输出角色标识User:,或者System等角色标识问题。
前端·人工智能
三七吃山漆3 小时前
攻防世界——wife_wife
前端·javascript·web安全·网络安全·ctf
用户47949283569153 小时前
面试官问"try-catch影响性能吗",我用数据打脸
前端·javascript·面试
GISer_Jing4 小时前
前端营销技术实战:数据+AI实战指南
前端·javascript·人工智能
GIS之路4 小时前
使用命令行工具 ogr2ogr 将 CSV 转换为 Shp 数据(二)
前端