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

苏州免费网站制作卢松松网站怎么做

苏州免费网站制作,卢松松网站怎么做,seo是指通过,重庆装修论坛TodoList主要是包含了CRUD功能#xff0c;本地存储功能#xff08;loaclStorage#xff09;总结#xff1a;全选按纽可以通过forEach循环来讲数据中的isCheck中的false删除实现就通过传递id#xff0c;然后根据filter循环将符合条件的数据返回成数组#xff0c;然后将返回…TodoList主要是包含了CRUD功能本地存储功能loaclStorage总结全选按纽可以通过forEach循环来讲数据中的isCheck中的false删除实现就通过传递id然后根据filter循环将符合条件的数据返回成数组然后将返回值赋给原数据时间的获取可以通过dayjs插件来获取首先 npm install dayjs -s来安装插件然后在组件中通过import dayjs from dayjs来导入插件最后通过dayjs(new Date).format(YY-MM-DD HH:MM)来获取时间随机数的获取 randomId(){return Number(Math.random().toString().substring(2,0)Date.now()).toString(10)},在CSS中有个知识点可以参考将元素居中使用如下的办法position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);获取input框的焦点当我们点击添加按钮后需要将光标放置到input框中这时我们需要聚焦首先在input框中添加ref属性input typetext refinputBox b. 然后在添加按钮中添加聚焦的方法 const inputLenth this.todoList.length - 1 console.log(inputLenth);this.$nextTick((){this.$refs.inputBox[inputLenth].focus()})在这段代码中需要注意的是我们要获取的是数组中最后一条数据因为index下标从0开始所以记着给length-1本地存储则是通过localStorage.getItem和localStorage.setItem来实现HTML代码templatediv classtodoListBoxdiv classheaderdiv classheader_leftdiv/divh2Todo List/h2/divdiv classheader_rightbutton classallBtn clickallSelect全选/buttonbutton classaddBtn clickaddText添加/button/div/divdiv classcontainerdiv classcontainer_item v-for(item,index) in todoList :keyitem.id!-- 选中 --div classcontainer_left clickselectText(item.id,index)span :styleitem.isCheck?opacity:1:opacity:0/span/div!-- 输入框 --input typetext v-modelitem.content:disableditem.isCheck:classitem.isCheck ? line-through: blurhandleInputrefinputBox!-- info --div classcontainer_right!-- 时间 --p{{item.time}}/pbutton clickdelText(item.id)删除/button/div/div/div/div /templateJS代码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(itemitem.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))}},} /scriptCSS代码style langscss 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[typetext]{flex: 1;margin: 0 10px;outline: none;// 背景设置透明background: transparent;border: none;border-bottom: 1px solid #ccc;padding: 5px 10px;color: #ccc;}}}} /style
http://www.w-s-a.com/news/320173/

相关文章:

  • 制作商业网站传奇网页游戏排名
  • 网站免费推广方案长沙房地产网站设计
  • 济南网站建设cnwenhui中交路桥建设网站
  • 韶关网站开发网站建设任务分解
  • 网站建设核心点阿根廷网站后缀
  • 哪些网站可以做招商广告语学校官网页面设计
  • 十堰城市建设网站网站开发流程宜春
  • 内江网站建设郑州网站优化外包
  • 土地流转网站建设项目云南抖音推广
  • 建设银行网站无法打开2021年有没有人给个网站
  • 高端手机网站建设网站建设岗位绩效
  • 泰安网络推广 网站建设 网站优化免费素材网站psd
  • 做企业网站联系网站开发具体的工作内容
  • 联合易网北京网站建设公司怎么样网站页面开发流程
  • 2015做那些网站能致富网站建设审批表
  • 深圳 网站设计个人名片模板
  • 网站建设费用选网络专业网站在线推广
  • 天津建设网站c2成绩查询用记事本制作html网页代码
  • 织梦二次开发手机网站如何成为一名设计师
  • 网站公司建设网站镇江本地网站
  • 网页设计后面是网站建设吗凡客诚品的配送方式
  • 万链网站做的怎么样?深圳门户网站开发
  • 在线设计工具的网站怎么做wordpress多语言版本号
  • 建设购物网站要求优秀网站大全
  • 平顶山做网站公司用源码网站好优化吗
  • 网上电商游戏优化大师手机版
  • 个人微信公众号怎么做微网站吗网站域名需要续费吗
  • 有效的网站建设公丹阳做网站的
  • 哪些行业做网站的多学企业网站开发
  • 外贸seo网站制作网站备案的流程