复习知识点整理

零碎语法

1.导入某个文件夹的index文件,index可以省略(这里导入的是router和store文件下的index.js文件)
在这里插入图片描述
2.路由懒加载

this

1.在vue文件中使用router\store对象时

this:普通函数的this指向vue实例对象(在没有明确指向的时候this指向window)
router和store挂载在vue上之后
在模板中使用 router或store的方法为 $router.xxx或$store.xxx
在方法中调用方式为:this.$router.xx或this.$store.xxx

2.在js文件中使用router\store对象时
使用什么需要导入时候,挂载在vue全局对象上的对象在vue文件中可以使用,在js文件中不能使用

网络通信

axios功能拆分写法

在这里插入图片描述
还可以配置拦截器

import axios from 'axios'

// 下面是克隆一份新的axios
const request = axios.create({
  baseURL: 'http://interview-api-t.itheima.net',
  timeout: 5000
})
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  // 在发送请求之前做些什么
  // config === https://www.axios-http.cn/docs/req_config === 请求的配置对象
  const token = localStorage.getItem('mobile-token')
  config.headers.Authorization = `Bearer ${token}`
  return config
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})

export default request


css预处理(Sass\Stylus\Less\Scss)

在这里插入图片描述

参考

相关推荐

  1. 【Python整理】 Python知识复习

    2024-04-08 12:46:03       36 阅读
  2. PHP知识复习

    2024-04-08 12:46:03       53 阅读
  3. Flutter知识整理

    2024-04-08 12:46:03       36 阅读
  4. Web期末复习知识

    2024-04-08 12:46:03       57 阅读
  5. 汇编期末复习知识

    2024-04-08 12:46:03       37 阅读
  6. React基本知识整理

    2024-04-08 12:46:03       44 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-08 12:46:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-08 12:46:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-08 12:46:03       82 阅读
  4. Python语言-面向对象

    2024-04-08 12:46:03       91 阅读

热门阅读

  1. ThreadLocal该何时注入值?

    2024-04-08 12:46:03       34 阅读
  2. python项目练习——18.文件加密和解密工具

    2024-04-08 12:46:03       39 阅读
  3. MySQL数据库下载安装教程(Windows&Linux)

    2024-04-08 12:46:03       34 阅读
  4. 06-User Login

    2024-04-08 12:46:03       35 阅读
  5. 设计模式面试题(九)

    2024-04-08 12:46:03       36 阅读
  6. Windows下Oracle表死锁处理过程

    2024-04-08 12:46:03       37 阅读