博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ToDoList案例
阅读量:2052 次
发布时间:2019-04-28

本文共 2837 字,大约阅读时间需要 9 分钟。

首先参考官网,先给案例进行布局,这是官网的效果图我们可以先进行参考

在这里插入图片描述
下面就开始我们的表演啦

ToDoList

这个是头部的布局

这是下面添加的部分

正在进行({
{nolength}})

  • {
    {item.tit}}

已完成({
{yeslength}})

  • {
    {item.tit}}

这是代码的抛出部分,方法

export default {  data() {    return {      content: "",      list: [],      updataIndex:-1, //要求修改元素的下标      tempValue:'' //临时记录要修改元素的值。修改前备份用    };  },  created(){    let list= localStorage.list;    if(list){      this.list=JSON.parse(list)    }  },  computed:{    nolength(){      let count=0      this.list.map(item=>{        if(!item.done){          count++        }      })      return count    },    yeslength(){      let count=0      this.list.map(item=>{        if(item.done){          count++        }      })      return count    }  },  methods: {    submit() {      // 非空校验      if(this.content.trim()==""){        return      }      this.list.push({        tit:this.content,        done:false      });      this.content=""            this.save()    },    del(index){      this.list.splice(index,1)      this.save()    },    sub(item,index){      this.updataIndex=index      this.tempValue=item.tit    },                                                     updateSave(){      this.updataIndex=-1      this.save()    },    back(item){      item.tit=this.tempValue      this.updataIndex=-1    },    change(item,state){      // if(checked){      //   item.done=true      // }else{      //   item.done=false      // }      item.done=state      this.save()    },    save(){    localStorage.list=JSON.stringify(this.list)  }  }};

这是下面的样式部分

.todolist1 {  width: 100%;  height: 50px;  background-color: #323232;  display: flex;  color: #dddddd;  font-size: 20px;  line-height: 50px;}.a {  margin-left: 50px;}.inputsub {  width: 45%;  height: 30px;  background-color: #fefefe;  border-radius: 5px;  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.24),    0 1px 6px rgba(0, 0, 0, 0.45) inset;  margin-left: 100px;  margin-top: 10px;  border: 0px;  color: #323232;}.del{  line-height: 40px;  font-size: 20px;  margin-left: 100px;}.li {  width: 93%;  height: 40px;  background-color: #ffffff;  border-left: 5px solid #629a9c;  margin-top: 10px;  border-radius: 5px;  list-style: none;  font-size: 18px;  line-height: 40px;}.checkbox{  width: 20px;  height: 20px;  margin-left: 10px;}.li2{  width: 93%;  height: 40px;  background-color: #E6E6E6;  border-left: 5px solid #629a9c;  margin-top: 10px;  border-radius: 5px;  list-style: none;  font-size: 18px;  line-height: 40px;}.list {  width: 100%;  height: 700px;  background-color: #cdcdcd;}.list-list{  margin-left: 30px;}

转载地址:http://vzylf.baihongyu.com/

你可能感兴趣的文章
免费分享一个最完美的英语学习素材 Englishpod
查看>>
Ceph CSI 3.0.0 发布了!
查看>>
2020年了,SparkStreaming 与 Kafka 还是性格不合。。
查看>>
为了解决 Prometheus 大内存问题,我竟然强行将 Prometheus Operator 给肢解了。。
查看>>
容器视角下的网络性能监控
查看>>
最炫酷的 Kubernetes Dashboard:Octant 迎来重大更新!
查看>>
查询亿级数据毫秒级返回!Elasticsearch 是如何做到的?
查看>>
我就感觉到快 —— zsh 和 oh my zsh 冷启动速度优化
查看>>
Prometheus监控神器-Alertmanager篇(二)
查看>>
Prometheus监控神器-Alertmanager篇(一)
查看>>
Kubernetes 的新武器:层级命名空间
查看>>
他在阿里5年,升为P9,现在直播不卖货,就要招各路云原生大师!
查看>>
知道吗?容器镜像也可以延迟拉取!
查看>>
Awesome Kubernetes 系列:第一期
查看>>
我是怎么莫名地劫持了自己的 DHCP 的
查看>>
现在是云原生最好的时代
查看>>
DDD 到底什么鬼?
查看>>
ElasticSearch Operator 工作原理浅析
查看>>
Thanos 与 VictoriaMetrics,谁才是打造大型 Prometheus 监控系统的王者?
查看>>
卧槽!竟然可以直接白嫖 Github Action 的 2C7G 服务器。。
查看>>