Web前端开发工具和依赖安装

各种安装:

node.js

https://nodejs.org/zh-cn/

安装完node.js 可以使用npm,npm跟随nodejs一起安装

powershell 复制代码
node --version  查看已安装node.js的版本,确认是否安装nodejs
npm -v 查看npm版本

npm install <Module Name> 安装模块
npm install -g <Module Name>    加-g全局安装<>模块

npm init vite@latest xxx(project name)  快速创建前端项目

npm run dev 启动

修改镜像源

修改镜像源为淘宝镜像:输入以下命令并回车

powershell 复制代码
npm config set registry [https://registry.npmmirror.com](https://registry.npmmirror.com)

修改镜像源为腾讯镜像源:输入以下命令并回车

powershell 复制代码
npm config set registry [http://mirrors.cloud.tencent.com/npm/](http://mirrors.cloud.tencent.com/npm/)

修改镜像源为华为镜像源:输入以下命令并回车

powershell 复制代码
npm config set registry [https://mirrors.huaweicloud.com/repository/npm/](https://mirrors.huaweicloud.com/repository/npm/)

pnpm 安装

速度快、节省磁盘空间的软件包管理器

powershell 复制代码
npm install -g pnpm

scss

css预处理语言, 样式

安装:

powershell 复制代码
  npm install sass --save

Element Plus

安装:

powershell 复制代码
  npm install element-plus --save

使用:

ts 复制代码
import ElementPlus from 'element-plus'  导入element-plus包
import 'element-plus/dist/index.css' 导入样式

createApp(App).use(ElementPlus).mount('#app')  使用

路由的配置

作用:URL地址和页面的适配

安装命令

powershell 复制代码
npm install vue-router@next --save

使用步骤:

1安装路由包

2新建页面

示例代码:

ts 复制代码
import {createRouter,createWebHistory} from 'vue-router'
import HomePage from "./views/HomePage.vue"
import LoveFlower from "./views/LoveFlower.vue"  
const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', component: HomePage },
    { path: '/loveflower', component: LoveFlower },   ],
})
export default router

vuex

Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式 + 库

安装:

powershell 复制代码
npm install vuex --save

使用:

  1. src目录下新建文件夹vuex,新建文件index.ts
  2. main函数里导入
ts 复制代码
import store from './vuex/index
  //挂载vuex
  app.use(store)

ecahrts

安装

powershell 复制代码
npm install echarts --save

教程官网:

https://echarts.apache.org/zh/index.html

axios

axios拦截器

安装

powershell 复制代码
npm install axios --save
相关推荐
m0_7381207242 分钟前
应急响应——知攻善防Web-3靶机详细教程
服务器·前端·网络·安全·web安全·php
程序员爱钓鱼8 小时前
Node.js 编程实战:文件读写操作
前端·后端·node.js
PineappleCoder8 小时前
工程化必备!SVG 雪碧图的最佳实践:ID 引用 + 缓存友好,无需手动算坐标
前端·性能优化
JIngJaneIL8 小时前
基于springboot + vue古城景区管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·后端
敲敲了个代码8 小时前
隐式类型转换:哈基米 == 猫 ? true :false
开发语言·前端·javascript·学习·面试·web
澄江静如练_9 小时前
列表渲染(v-for)
前端·javascript·vue.js
JustHappy9 小时前
「chrome extensions🛠️」我写了一个超级简单的浏览器插件Vue开发模板
前端·javascript·github
Loo国昌9 小时前
Vue 3 前端工程化:架构、核心原理与生产实践
前端·vue.js·架构
sg_knight9 小时前
拥抱未来:ECMAScript Modules (ESM) 深度解析
开发语言·前端·javascript·vue·ecmascript·web·esm