html部分
<div id="app" v-cloak>
<p class="title-Black">小黑记事本</p>
<div class="head-box">
<input class="record-box" type="text" placeholder="请输入非空的内容,点击加号记录" v-model.trim="todoLIST" @keyup.enter="addBox">
<button class="record-but" @click="addBox">+</button>
</div>
<table>
<tr v-for="(item,index) in todoList">
<td @dblclick="dblclickBox(index)">{{index+1}}.{{item.name}}</td>
<td>
<a class="remove-btn" @click="removeList(index)">x</a>
</td>
</tr>
</table>
<input type="text" class="base-box" placeholder="双击栏目删除对应数据">
</div>```
## css部分
```css
<style>
[v-cloak]{
display: none;
}
#app {
width: 303px;
min-height: 400px;
margin: 0 auto;
text-align: center;
position: relative;
}
.title-Black {
width: 100%;
height: 20px;
font-size: 20px;
font-weight: bold;
}
.record-box {
width: 250px;
height: 40px;
font-weight: bold;
display: block;
float: left;
}
.record-but {
width: 40px;
height: 46px;
font-weight: bold;
font-size: 30px;
line-height: 40px;
display: block;
float: left;
margin-left: 5px;
}
ul {
list-style: none;
}
a{
text-align: center;
}
.base-box {
width: 100%;
height: 40px;
position: absolute;
bottom: 0;
float: right;
display: block;
margin: 0 auto;
border: none;
text-align: center;
}
.head-box {
height: 50px;
}
.remove-btn {
display: block;
width: 25px;
height: 24px;
font-size: 16px;
line-height: 20px;
float: right;
border: 1px solid #ccc;
}
tr {
width: 100%;
font-weight: bold;
font-size: 16px;
}
td {
width: 100%;
height: 30px;
text-align: left;
margin: 5px 0px;
border-bottom: 1px solid #ccc;
}
</style>```
## vue引入以及vue部分
``<script src="../lib/vue.js"></script>
<script>
const app = new Vue({
el: "#app",
data:{
todoList:[
],
todoLIST:[]
},
methods:{
removeList(index){
this.todoList.splice(index,1)
},
addBox(){
if(this.todoLIST == "")return
this.todoList.push({
name:this.todoLIST,
})
this.todoLIST=""
},
dblclickBox(index){
this.removeList(index)
}
}
})
</script>
### 最后效果

|