1. this.$router.push('./路径')
跳转
2. export default
与 import 名字 from 路径
-
默认导入导出
– 导出: export default 数据
– 导入: import 名字 from 路径
– 导入的时候名字可以随便写
– 导入的是它默认暴露的那个值
– 一个文件,默认暴露只能暴露一次 -
按名字导入导出
– 导出: export const 名字 = 数据
– 导入: import { 名字 } from 路径
– 导入的时候加了大括号,就一定是按名字导入,不加大括号就一定是默认导入
– 一个文件里可以既有默认暴露,也可以有按名字暴露
– 默认暴露只能写一个,按名字可以多个
3. 设置路由
//设置规则
const routes = [
{ path : ‘/login’ , component:login },
{path : ‘/’ , redirect:’/login’ },
]
3.1 path : 路径
3.2 component : 组件名 与保存的导入组件名相同
3.3 redirect : 重定向
//创建路由对象
const router = new VueRouter({
routes
})
4. scoped
设置在style中
作用 : 本页面的样式不会影响到其他页面 只会作用在本页面
5. router
与 index
在el-menu
标签内添加router
就能通过index直接访问到指定的子组件
6. window.localStorage.removeItem('userInfo')
删除localStorage中的token
7 message
消息提示
this.$message.success( ' ' )
//绿色
this.$message.error ( ' ' )
红色
this.$message.warning( ' ' )
橙色
this.$message( ' ' )
灰色
8 el-form
中的属性
8.1 el-form
表单 根标签 设置 :model
:rules="rules" ``ref="form"
:inline="true"
设置之后变为当行显示
8.2 设置label 表单的标题