封装动态添加路由(router.beforeEach)
动态路由封装
对比两个对象是否完全相同
对象是否完全想同
使用axios.create 封装参数
request (options) {
const instance = axios.create()
options = Object.assign(this.getInsideConfig(), options)
this.interceptors(instance, options.url)
return instance(options)
}
- 其中options的配置项
baseURL: 'https://s-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar',"token","token"},
url:``,
methods:"post/get///",
data,
paramas,
盒子拖拽
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
body {
display: flex;
padding: 100px;
}
div {
width: 100px;
height: 100px;
margin-right: 50px;
}
</style>
<body>
<div style="background:purple" draggable="true">DIV1</div>
<div style="background:orange" draggable="true">DIV1</div>
<div style="background:aqua" draggable="true">DIV1</div>
</body>
<script>
let div = document.getElementsByTagName("div");
let container = null;
for(let i=0;i<div.length;i++){
div[i].ondragstart = function(){
container = this;
}
div[i].ondragover = function(){
event.preventDefault();
}
div[i].ondrop = function(){
if (container != null && container != this) {
let temp = document.createElement("div")
document.body.replaceChild(temp,this)
document.body.replaceChild(this,container)
document.body.replaceChild(container,temp)
}
}
}
</script>
</html>
详细介绍 vue 调用移动端 扫码功能
1.扫码功能
2.扫码功能
监听视图是否可见 到什么地步可见
IntersectionObserver