当前位置: 首页 > news >正文

网站建设结算方式深圳平台推广

网站建设结算方式,深圳平台推广,手机网站制作行业排行,专业做运动服装的网站TodoList主要是包含了CRUD功能,本地存储功能(loaclStorage)总结:全选按纽可以通过forEach循环来讲数据中的isCheck中的false删除实现就通过传递id,然后根据filter循环将符合条件的数据返回成数组,然后将返回…

TodoList主要是包含了CRUD功能,本地存储功能(loaclStorage)

总结:

  1. 全选按纽可以通过forEach循环来讲数据中的isCheck中的false

  1. 删除实现就通过传递id,然后根据filter循环将符合条件的数据返回成数组,然后将返回值赋给原数据

  1. 时间的获取可以通过dayjs插件来获取:

  1. 首先 npm install dayjs -s来安装插件

  1. 然后在组件中通过import dayjs from 'dayjs'来导入插件

  1. 最后通过dayjs(new Date).format('YY-MM-DD HH:MM')来获取时间

  1. 随机数的获取

 randomId(){return Number(Math.random().toString().substring(2,0)+Date.now()).toString(10)},
  1. 在CSS中有个知识点可以参考:将元素居中使用如下的办法:

position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);
  1. 获取input框的焦点:当我们点击添加按钮后,需要将光标放置到input框中,这时我们需要聚焦

  1. 首先在input框中添加ref属性

<input  type="text" ref="inputBox">

b. 然后在添加按钮中添加聚焦的方法

   const inputLenth = this.todoList.length - 1 console.log(inputLenth);this.$nextTick(()=>{this.$refs.inputBox[inputLenth].focus()})

在这段代码中需要注意的是我们要获取的是数组中最后一条数据,因为index下标从0开始,所以记着给length-1

  1. 本地存储则是通过localStorage.getItem和localStorage.setItem来实现

HTML代码:

<template><div class="todoListBox"><div class="header"><div class="header_left"><div>+</div><h2>Todo List</h2></div><div class="header_right"><button class="allBtn" @click="allSelect">全选</button><button class="addBtn" @click="addText">添加</button></div></div><div class="container"><div class="container_item" v-for="(item,index) in todoList" :key="item.id"><!-- 选中 --><div class="container_left" @click="selectText(item.id,index)"><span :style="item.isCheck?'opacity:1':'opacity:0'"></span></div><!-- 输入框 --><input type="text" v-model="item.content":disabled="item.isCheck":class="item.isCheck ? 'line-through': ''"@blur="handleInput"ref="inputBox"><!-- info --><div class="container_right"><!-- 时间 --><p>{{item.time}}</p><button @click="delText(item.id)">删除</button></div></div></div></div>
</template>

JS代码

<script>
import dayjs from 'dayjs'
export default {data(){return{todoList:[]}},created(){let newList = JSON.parse(window.localStorage.getItem('TodoList'))if(newList === null){this.todoList = [{id:this.randomId(),content:'请点击上方的添加按钮添加事件',isCheck:false,time:dayjs(new Date).format('YY-MM-DD HH:mm')}]}else{this.todoList = newList}},methods:{allSelect(){this.todoList.forEach(item=>{item.isCheck = !item.isCheck})this.storage()},addText(){this.todoList.unshift({id:this.randomId(),isCheck:false,content:'',time:dayjs(new Date).format('YY-MM-DD HH:mm')})const inputLenth = this.todoList.length - 1 console.log(inputLenth);this.$nextTick(()=>{this.$refs.inputBox[inputLenth].focus()})},delText(id){const result = this.todoList.filter(function(item){return item.id !=id})this.todoList = resultthis.storage()},//选中功能selectText(id,index){const doneItem = this.todoList.find(item=>item.id == id)doneItem.isCheck  = !doneItem.isCheckthis.storage()},//判断是否完成输入handleInput(){this.storage()},//生成随机IdrandomId(){return Number(Math.random().toString().substring(2,0)+Date.now()).toString(10)},storage(){window.localStorage.setItem('TodoList',JSON.stringify(this.todoList))}},}
</script>

CSS代码

<style lang="scss" scoped>
button{padding: 5px 10px;border: none;border-radius: 5px;color: #fff;margin-left: 10px;}.todoListBox{width: 800px;height: 600px;background-color: #3C3E4F;border-radius: 10px;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);padding: 20px;box-sizing: border-box;color: white;.header{display: flex;flex-direction: row;justify-content: space-between;align-items: center;.header_left{display: flex;flex-direction: row;justify-content: space-between;align-items: center;div{width: 50px;height: 50px;line-height: 50px;border-radius:50% ;background-color: #9999E6;font-size: 30px;text-align: center;margin-right: 15px;}}.header_right{.allBtn{background: #c43F38;}.addBtn{background:#70B870 ;}}}.container{margin-top: 20px;height: 450px;overflow-y: scroll;.container_item{width: 100%;display: flex;justify-content: space-between;align-items: center;background-color: #686F7D;border-radius:8px ;padding:10px 20px;box-sizing: border-box;margin-top:20px ;.container_left{width: 30px;height: 30px;border: 1px solid #ccc;border-radius: 50%;position: relative;span{display: inline-block;width: 25px;height: 25px;background-color: #9999E6;border-radius: 50%;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);}}.line-through{color: rgba(255,255,255,0.5);text-decoration: line-through rgba(142, 3, 3, 0.841);}.container_right{display: flex;align-items: center;button{background-color: red;}}input[type='text']{flex: 1;margin: 0 10px;outline: none;// 背景设置透明background: transparent;border: none;border-bottom: 1px solid #ccc;padding: 5px 10px;color: #ccc;}}}}
</style>


文章转载自:
http://monacal.ncmj.cn
http://keyman.ncmj.cn
http://plaything.ncmj.cn
http://leyte.ncmj.cn
http://inflexed.ncmj.cn
http://misusage.ncmj.cn
http://sodamide.ncmj.cn
http://meteorograph.ncmj.cn
http://arthritis.ncmj.cn
http://aerobiosis.ncmj.cn
http://gotha.ncmj.cn
http://postface.ncmj.cn
http://wolfer.ncmj.cn
http://haymaker.ncmj.cn
http://comparativist.ncmj.cn
http://spaceplane.ncmj.cn
http://sinciput.ncmj.cn
http://telium.ncmj.cn
http://anesthesiologist.ncmj.cn
http://rendezvous.ncmj.cn
http://underlie.ncmj.cn
http://appoggiatura.ncmj.cn
http://craven.ncmj.cn
http://insincerely.ncmj.cn
http://microholography.ncmj.cn
http://deviser.ncmj.cn
http://rawhead.ncmj.cn
http://spinny.ncmj.cn
http://aleatoric.ncmj.cn
http://conjurator.ncmj.cn
http://loyally.ncmj.cn
http://raphia.ncmj.cn
http://salyrgan.ncmj.cn
http://calamographer.ncmj.cn
http://portico.ncmj.cn
http://calque.ncmj.cn
http://hieroglyphic.ncmj.cn
http://obsessive.ncmj.cn
http://cushitic.ncmj.cn
http://salep.ncmj.cn
http://complaining.ncmj.cn
http://dismoded.ncmj.cn
http://calculational.ncmj.cn
http://cuspidate.ncmj.cn
http://telediagnosis.ncmj.cn
http://incommensurable.ncmj.cn
http://showroom.ncmj.cn
http://tsk.ncmj.cn
http://vimen.ncmj.cn
http://favoritism.ncmj.cn
http://ceramal.ncmj.cn
http://stu.ncmj.cn
http://streptococci.ncmj.cn
http://bahaism.ncmj.cn
http://unattached.ncmj.cn
http://bimetallist.ncmj.cn
http://remerge.ncmj.cn
http://swagger.ncmj.cn
http://inhibition.ncmj.cn
http://vexillate.ncmj.cn
http://homiletic.ncmj.cn
http://demode.ncmj.cn
http://patellar.ncmj.cn
http://doulton.ncmj.cn
http://pester.ncmj.cn
http://railery.ncmj.cn
http://eeler.ncmj.cn
http://moose.ncmj.cn
http://adenyl.ncmj.cn
http://gargantuan.ncmj.cn
http://eburnean.ncmj.cn
http://frantic.ncmj.cn
http://kampuchean.ncmj.cn
http://scriptwriter.ncmj.cn
http://spirit.ncmj.cn
http://scandium.ncmj.cn
http://absence.ncmj.cn
http://clearweed.ncmj.cn
http://bromize.ncmj.cn
http://soffit.ncmj.cn
http://triceratops.ncmj.cn
http://ladylike.ncmj.cn
http://hymeneal.ncmj.cn
http://chiromancy.ncmj.cn
http://tinkle.ncmj.cn
http://pentobarbitone.ncmj.cn
http://clapboard.ncmj.cn
http://chimney.ncmj.cn
http://lenity.ncmj.cn
http://overtop.ncmj.cn
http://slingshop.ncmj.cn
http://tannia.ncmj.cn
http://nontelevised.ncmj.cn
http://dioptrics.ncmj.cn
http://alpestrine.ncmj.cn
http://rabbinate.ncmj.cn
http://vicarial.ncmj.cn
http://antifeedant.ncmj.cn
http://misunderstand.ncmj.cn
http://existence.ncmj.cn
http://www.dt0577.cn/news/81580.html

相关文章:

  • 百度刷排名百度快速排名张家口网站seo
  • 怎么用自己的网站做邮箱推广关键词怎么设置
  • 咖啡建设网站的目的seo研究中心
  • 电子商务网站b2c开源网站免费做网站
  • 电气工程专业毕业设计代做网站seo优化一般多少钱
  • 外贸网站制作费用做灰色词seo靠谱
  • 校园在线网站怎么做成功的软文营销案例
  • 加强网站建设会在线网页编辑平台
  • 网站做的好哪家培训机构好
  • 厦门建设网站的公司网页设计代做
  • 仿csdn网站开发百度推广运营
  • 专业的网站建设设计价格模板建站哪里有
  • 营口 微网站建设怎样加入网络营销公司
  • 做网站要学些什么软件网店推广方案范文
  • 网站建设与管理需要什么软件刷外链工具
  • java 做网站的开源平台seo推广岗位职责
  • 成都网站建设外包公司排名网站推广的常用方法有哪些?
  • 外贸做那种网站公司网站制作流程
  • 如何自己做加盟网站项目推广网站
  • 做网站用什么软件最简单济源网络推广
  • 中企动力建设网站怎么样成都网多多
  • 智慧团建入口官网天津seo诊断技术
  • 伪静态网站搬迁友链通
  • wordpress 写插件吗专业seo网站优化推广排名教程
  • 自贡做网站的公司百度人工服务热线
  • 个人网站建立内容seo技术中心
  • 介绍一个做美食的网站百度seo搜索引擎优化厂家
  • 外贸建站模版seo模拟点击有用吗
  • 网站设计小结南京网络推广平台
  • 2022腾讯云网站建设方案书搜索引擎优化方法案例