不引入外部包实现盒子拖拽
<!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>
<style>
div {
width: 100px;
height: 100px;
background-color: black;
position: absolute;
top: 0px;
left: 0px;
}
</style>
</head>
<body>
<div></div>
<script>
var div = document.querySelector('div');
//给div注册监听事件
div.addEventListener('mousedown', function (e) {
//给页面注册监听事件
document.addEventListener('mousemove', move);
//当我鼠标松开时注册监听事件
document.addEventListener('