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
相关推荐
bearpping4 小时前
Nginx 配置:alias 和 root 的区别
前端·javascript·nginx
@大迁世界5 小时前
07.React 中的 createRoot 方法是什么?它具体如何运作?
前端·javascript·react.js·前端框架·ecmascript
January12075 小时前
VBen Admin Select 选择框选中后仍然显示校验错误提示的解决方案
前端·vben
. . . . .5 小时前
前端测试框架:Vitest
前端
xiaotao1315 小时前
什么是 Tailwind CSS
前端·css·css3
战南诚6 小时前
VUE中,keep-alive组件与钩子函数的生命周期
前端·vue.js
发现一只大呆瓜6 小时前
React-彻底搞懂 Redux:从单向数据流到 useReducer 的终极抉择
前端·react.js·面试
霍理迪7 小时前
Vue的响应式和生命周期
前端·javascript·vue.js
李剑一7 小时前
别再瞎写了!Cesium 模型 360° 环绕,4 套源码全公开,项目直接用
前端