使用 Poptip 组件 https://www.iviewui.com/view-ui-plus/component/view/poptip
鼠标 移入 移出事件 。弹窗 用 定位就可以做
纯js 就用 display:none 和block控制
jq 就用 hide,show来实现
至于 带箭头的 弹窗
https://blog.csdn.net/WanDerEr950921/article/details/102758596
<!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>弹窗</title>
<style>
* {
margin: 0;
padding: 0;
}
.txt {
width: 48px;
height: 48px;
border-radius: 50%;
background: red;
text-align: center;
line-height: 48px;
cursor: pointer;
position: relative;
}
.box {
position: absolute;
left: 50px;
width: 100px;
height: 100px;
background: red;
top: 0px;
display: none;
}
</style>
</head>
<body>
<div class="txt" id="txt">
好文
</div>
<div class="box" id="box">
55555
</div>
</body>
<script>
let txt = document.getElementById("txt");
let box = document.getElementById("box");
txt.addEventListener("mouseover", function () {
box.style.display = "block"
})
txt.addEventListener("mouseleave", function () {
box.style.display = "none"
})
</script>
</html>
根据你描述的问题,使用view-ui-plus 的 Poptip 组件能实现您想要的效果,具体可以参照官网文档 https://www.iviewui.com/