话不多说,先上图:
当点击右侧的加号,会自动动态创建新的一个选项,如下图:
当点击标签右上角的叉号,会删除选项栏:
双击tab栏某一选项栏,可以更改选项栏的内容,如下图:
接下来废话不多说了,上源码:
htnl机构:
<!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>tab栏切换</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.fence {
margin: 100px auto;
width: 1000px;
height: 300px;
/* background-color: pink; */
border: 1px solid #ccc;
}
.tab {
list-style: none;
/* background-color: yellow; */
height: 40px;
line-height: 40px;
text-align: center;
}
.tab li {
position: relative;
height: 100%;
float: left;
width: 100px;
border: 1px solid red;
border-collapse: collapse;
cursor: p