一. Element-Plus 集成
1.1. 全局引入
1.2. 按需引入
1.3. 图标的引入
1.4. ElMessage 引入
二。搭建登录页面
2.1. 背景的搭建
- 100vw/vh
2.2. 登录界面 Panel
2.2.1. 整体界面的搭建
- 标题
- tabs
- 记住密码 / 忘记链接 (组件)
- 立即登录 (组件)
2.2.2. tabs 搭建过程
- label 的插槽使用
- 内容显示
2.2.3. 账号登录 form
- ElForm/ElFormItem/ElInput
- 绑定属性
2.2.4. form 的校验规则
2.2.5. 点击立即登录
- 父组件发生点击,执行子组件的函数.
- defineExpose()
- const accountRef = ref<InstanceType<typeof PaneAccount>>()
2.3. 登录的操作
2.3.1. form 通过验证
- formRef.validate (回调)
2.3.2. 登录接口的调用
- post
- data: {name, password}
2.3.3. 将登录操作 store 中
2.3.4. IAccount 类型的定义
2.4. postman 的使用
2.5. token 缓存和 cache 封装