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

dede手机wap网站模板wordpress评论后可见

dede手机wap网站模板,wordpress评论后可见,沈阳网站搜索排名,wordpress的官方网站今天主要是做一个案例 TodoList 组件化编码流程#xff1a; 1. 拆分静态组件#xff1a;组件要按照功能点拆分#xff0c;命名不要与html元素冲突 2.实现动态组件#xff1a;考虑好数据的存放位置#xff0c;数据是一个组件在用#xff0c;还是一些组件在用#xff1a…今天主要是做一个案例 TodoList 组件化编码流程 1. 拆分静态组件组件要按照功能点拆分命名不要与html元素冲突 2.实现动态组件考虑好数据的存放位置数据是一个组件在用还是一些组件在用             1.一个组件在用放在组件自身即可             2.一些组件在用放在他们共同的父组件上状态提升 3.实现交互从绑定事件开始 props适用于 1.父组件 子组件 通信   2.子组件 父组件 通信要求父组件先给子组件一个函数 使用v-model时要切记v-model绑定的值不能是props传过来的值因为props是不可以修改的 props传过来的若是对象类型的值修改对象中的属性时Vue不会报错但不推荐这样做   主要是组件之间的交互 APP.vue template div idrootdiv classtodo-containerdiv classtodo-wrapMyHeaderVue :addTodoaddTodo/MyHeaderVueMyListVue :todostodos :checkTodocheckTodo :deleteTododeleteTodo/MyListVueMyFooterVue :todostodos :checkAllTodocheckAllTodo/MyFooterVue/div/div /div/templatescript import MyFooterVue from ./components/MyFooter.vue import MyHeaderVue from ./components/MyHeader.vue import MyListVue from ./components/MyList.vueexport default {name:App,components:{MyHeaderVue,MyFooterVue,MyListVue},data(){return{todos:[{id:001,title:吃饭,done:true},{id:002,title:喝酒,done:false},{id:003,title:开车,done:true}]}},methods:{//添加一个todoaddTodo(todoObj){this.todos.unshift(todoObj)},//勾选or勾选取消一个todocheckTodo(id){this.todos.forEach((todo){if(todo.idid) todo.done!todo.done})},//删除一个tododeleteTodo(id){this.todosthis.todos.filter((todo){return todo.id !id})},//全选or全不选checkAllTodo(done){this.todos.forEach((todo){todo.donedone})}}} /scriptstyle /*base*/ body {background: #fff; } .btn {display: inline-block;padding: 4px 12px;margin-bottom: 0;font-size: 14px;line-height: 20px;text-align: center;vertical-align: middle;cursor: pointer;box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);border-radius: 4px; } .btn-danger {color: #fff;background-color: #da4f49;border: 1px solid #bd362f; } .btn-danger:hover {color: #fff;background-color: #bd362f; } .btn:focus {outline: none; } /*app*/ .todo-container {width: 600px;margin: 0 auto; } .todo-container .todo-wrap {padding: 10px;border: 1px solid #ddd;border-radius: 5px; }/style MyHeader.vue templatediv classtodo-headerinput typetext placeholder请输入你的任务名称按回车键确认 v-modeltitle keyup.enteradd//div /templatescript import {nanoid} from nanoidexport default {name:MyHeader,props:[addTodo],data(){return{title:}},methods:{add(){//校验数据if(!this.title) return alert(输入不能为空)//将用户的输入包装成一个todo对象const todoObj{id:nanoid(),title:this.title,done:false}//停止App组件添加一个todo对象this.addTodo(todoObj)//清空输入this.title}},} /scriptstyle scoped /*header*/ .todo-header input {width: 560px;height: 28px;font-size: 14px;border: 1px solid #ccc;border-radius: 4px;padding: 4px 7px; } .todo-header input:focus {outline: none;border-color: rgba(82, 168, 236, 0.8);box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); } /style MyList.vue template ul classtodo-mainMyItemVue v-fortodoObj in todos :keytodoObj.id :todotodoObj :checkTodocheckTodo :deleteTododeleteTodo/MyItemVue/ul/templatescript import MyItemVue from ./MyItem.vueexport default {name:MyList,components:{MyItemVue},props:[todos,checkTodo,deleteTodo] } /scriptstyle scoped /*main*/ .todo-main {margin-left: 0px;border: 1px solid #ddd;border-radius: 2px;padding: 0px; } .todo-empty {height: 40px;line-height: 40px;border: 1px solid #ddd;border-radius: 2px;padding-left: 5px;margin-top: 10px; } /style MyItem.vue templatelilabelinput typecheckbox :checkedtodo.done changehandleCheck(todo.id)/span{{todo.title}}/span/labelbutton classbtn btn-danger clickhandleDelete(todo.id) 删除/button/li /templatescript export default {name:MyItem,//声明接收todo对象props:[todo,checkTodo,deleteTodo],methods:{//勾选or取消勾选handleCheck(id){//通知App组件将对应的todo.done取反this.checkTodo(id)},//删除handleDelete(id){if(confirm(确定删除吗)){this.deleteTodo(id)}}} } /scriptstyle scoped /*item*/ li {list-style: none;height: 36px;line-height: 36px;padding: 0 5px;border-bottom: 1px solid #ddd; }li label {float: left;cursor: pointer; }li label li input {vertical-align: middle;margin-right: 6px;position: relative;top: -1px; }li button {float: right;display: none;margin-top: 3px; }li:before {content: initial; }li:last-child {border-bottom: none; }li:hover{background-color:#ddd; }li:hover button{display: block; } /style MyFooter.vue templatediv classtodo-footer v-showtotallabelinput typecheckbox :checkedisAll changecheckAll //labelspanspan已完成{{doneTotal}}/span / 全部{{total}}/spanbutton classbtn btn-danger清除已完成任务/button/div /templatescript export default {name:MyFooter,props:[todos,checkAllTodo],computed:{total(){return this.todos.length},doneTotal(){return this.todos.reduce((pre,todo) pre (todo.done? 1:0),0)/**const xthis.todos.reduce((pre,current){return pre (current.done ?1:0)},0)*/},isAll(){return this.doneTotal this.total this.total0}},methods:{checkAll(e){this.checkAllTodo(e.target.checked)}}} /scriptstyle scoped /*footer*/ .todo-footer {height: 40px;line-height: 40px;padding-left: 6px;margin-top: 5px; }.todo-footer label {display: inline-block;margin-right: 20px;cursor: pointer; }.todo-footer label input {position: relative;top: -1px;vertical-align: middle;margin-right: 5px; }.todo-footer button {float: right;margin-top: 5px; } /style 本地存储 1.存储内容大小一般支持5MB左右不同浏览器可能还不一样 2.浏览器端通过Window.sessionStorage和Window.localStorage属性来实现本地存储机制 3.相关API 1.xxxStorage.setItem(key, value)该方法接受一个键和值作为参数会把键值对添加到存储中如果键名存在则更新其对应的值          2.xxxStorage.getItem(key)该方法接受一个键名作为参数返回键名对应的值          3.xxxStorage.removeItem(key)该方法接受一个键名作为参数并把该键名从存储中删除          4.xxxStorage.clear()该方法会清空存储中的所有数据 4.备注 1.SessionStorage存储的内容会随着浏览器窗口关闭而消失         2.LocalStorage存储的内容需要手动清除才会消失         3.xxxStorage.getItem(xxx)如果 xxx 对应的 value 获取不到那么getItem()的返回值是null         4.JSON.parse(null)的结果依然是null   localStorage.html !DOCTYPE html html langen headmeta charsetUTF-8titleloaclStorage/title /head bodyh2localStorage/h2button onclicksaveDate()点我保存一个数据/buttonbutton onclickreadDate()点我读取一个数据/buttonbutton onclickdeleteDate()点我删除一个数据/buttonbutton onclickdeleteAllDate()点我清空一个数据/buttonscript typetext/javascriptlet p{name:张三,age:18}function saveDate(){localStorage.setItem(msg,hello)localStorage.setItem(person,JSON.stringify(p))}function readDate(){console.log(localStorage.getItem(msg))const result localStorage.getItem(person)console.log(JSON.parse(result))}function deleteDate(){localStorage.removeItem(msg)}function deleteAllDate(){localStorage.clear()}/script /body /html sessionStorage.html !DOCTYPE html html langen headmeta charsetUTF-8titlesessionStorage/title /head bodyh2sessionStorage/h2button onclicksaveDate()点我保存一个数据/buttonbutton onclickreadDate()点我读取一个数据/buttonbutton onclickdeleteDate()点我删除一个数据/buttonbutton onclickdeleteAllDate()点我清空一个数据/buttonscript typetext/javascriptlet p{name:张三,age:18}function saveDate(){sessionStorage.setItem(msg,hello)sessionStorage.setItem(person,JSON.stringify(p))}function readDate(){console.log(sessionStorage.getItem(msg))const result sessionStorage.getItem(person)console.log(JSON.parse(result))}function deleteDate(){sessionStorage.removeItem(msg)}function deleteAllDate(){sessionStorage.clear()}/script /body /html TodoList 本地存储 在上面案例中进行一个优化使其添加一个本地存储的功能 template div idrootdiv classtodo-containerdiv classtodo-wrapMyHeaderVue :addTodoaddTodo/MyHeaderVueMyListVue :todostodos :checkTodocheckTodo :deleteTododeleteTodo/MyListVueMyFooterVue :todostodos :checkAllTodocheckAllTodo/MyFooterVue/div/div /div/templatescript import MyFooterVue from ./components/MyFooter.vue import MyHeaderVue from ./components/MyHeader.vue import MyListVue from ./components/MyList.vueexport default {name:App,components:{MyHeaderVue,MyFooterVue,MyListVue},data(){return{todos:JSON.parse(localStorage.getItem(todos)) || []}},methods:{//添加一个todoaddTodo(todoObj){this.todos.unshift(todoObj)},//勾选or勾选取消一个todocheckTodo(id){this.todos.forEach((todo){if(todo.idid) todo.done!todo.done})},//删除一个tododeleteTodo(id){this.todosthis.todos.filter((todo){return todo.id !id})},//全选or全不选checkAllTodo(done){this.todos.forEach((todo){todo.donedone})}},watch:{todos:{deep:true,handler(value){localStorage.setItem(todos,JSON.stringify(value))}}},} /scriptstyle /*base*/ body {background: #fff; } .btn {display: inline-block;padding: 4px 12px;margin-bottom: 0;font-size: 14px;line-height: 20px;text-align: center;vertical-align: middle;cursor: pointer;box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);border-radius: 4px; } .btn-danger {color: #fff;background-color: #da4f49;border: 1px solid #bd362f; } .btn-danger:hover {color: #fff;background-color: #bd362f; } .btn:focus {outline: none; } /*app*/ .todo-container {width: 600px;margin: 0 auto; } .todo-container .todo-wrap {padding: 10px;border: 1px solid #ddd;border-radius: 5px; }/style
文章转载自:
http://www.morning.pqyms.cn.gov.cn.pqyms.cn
http://www.morning.xflzm.cn.gov.cn.xflzm.cn
http://www.morning.yrjym.cn.gov.cn.yrjym.cn
http://www.morning.khtyz.cn.gov.cn.khtyz.cn
http://www.morning.yuminfo.com.gov.cn.yuminfo.com
http://www.morning.cybch.cn.gov.cn.cybch.cn
http://www.morning.crhd.cn.gov.cn.crhd.cn
http://www.morning.chbcj.cn.gov.cn.chbcj.cn
http://www.morning.cnqff.cn.gov.cn.cnqff.cn
http://www.morning.ypdhl.cn.gov.cn.ypdhl.cn
http://www.morning.xwzsq.cn.gov.cn.xwzsq.cn
http://www.morning.khxyx.cn.gov.cn.khxyx.cn
http://www.morning.cldgh.cn.gov.cn.cldgh.cn
http://www.morning.zcsyz.cn.gov.cn.zcsyz.cn
http://www.morning.fcftj.cn.gov.cn.fcftj.cn
http://www.morning.hflrz.cn.gov.cn.hflrz.cn
http://www.morning.xtdms.com.gov.cn.xtdms.com
http://www.morning.trbxt.cn.gov.cn.trbxt.cn
http://www.morning.c7630.cn.gov.cn.c7630.cn
http://www.morning.kspfq.cn.gov.cn.kspfq.cn
http://www.morning.hbkkc.cn.gov.cn.hbkkc.cn
http://www.morning.gmwdl.cn.gov.cn.gmwdl.cn
http://www.morning.kyflr.cn.gov.cn.kyflr.cn
http://www.morning.trzzm.cn.gov.cn.trzzm.cn
http://www.morning.mtbsd.cn.gov.cn.mtbsd.cn
http://www.morning.ndyrb.com.gov.cn.ndyrb.com
http://www.morning.zkbxx.cn.gov.cn.zkbxx.cn
http://www.morning.ljfjm.cn.gov.cn.ljfjm.cn
http://www.morning.ydnx.cn.gov.cn.ydnx.cn
http://www.morning.yznsx.cn.gov.cn.yznsx.cn
http://www.morning.npfrj.cn.gov.cn.npfrj.cn
http://www.morning.rcbdn.cn.gov.cn.rcbdn.cn
http://www.morning.cptzd.cn.gov.cn.cptzd.cn
http://www.morning.hkswt.cn.gov.cn.hkswt.cn
http://www.morning.krnzm.cn.gov.cn.krnzm.cn
http://www.morning.nfpkx.cn.gov.cn.nfpkx.cn
http://www.morning.drpbc.cn.gov.cn.drpbc.cn
http://www.morning.qrwnj.cn.gov.cn.qrwnj.cn
http://www.morning.nqmwk.cn.gov.cn.nqmwk.cn
http://www.morning.qfqld.cn.gov.cn.qfqld.cn
http://www.morning.nsfxt.cn.gov.cn.nsfxt.cn
http://www.morning.tmpsc.cn.gov.cn.tmpsc.cn
http://www.morning.wlbwp.cn.gov.cn.wlbwp.cn
http://www.morning.ybshj.cn.gov.cn.ybshj.cn
http://www.morning.yhplt.cn.gov.cn.yhplt.cn
http://www.morning.zwpzy.cn.gov.cn.zwpzy.cn
http://www.morning.ljtwp.cn.gov.cn.ljtwp.cn
http://www.morning.qfqld.cn.gov.cn.qfqld.cn
http://www.morning.rjnx.cn.gov.cn.rjnx.cn
http://www.morning.lksgz.cn.gov.cn.lksgz.cn
http://www.morning.qmbpy.cn.gov.cn.qmbpy.cn
http://www.morning.ktyww.cn.gov.cn.ktyww.cn
http://www.morning.ftmp.cn.gov.cn.ftmp.cn
http://www.morning.hqsnt.cn.gov.cn.hqsnt.cn
http://www.morning.trnhy.cn.gov.cn.trnhy.cn
http://www.morning.mwlxk.cn.gov.cn.mwlxk.cn
http://www.morning.hcgbm.cn.gov.cn.hcgbm.cn
http://www.morning.jgzmr.cn.gov.cn.jgzmr.cn
http://www.morning.ftsmg.com.gov.cn.ftsmg.com
http://www.morning.qxxj.cn.gov.cn.qxxj.cn
http://www.morning.mhmcr.cn.gov.cn.mhmcr.cn
http://www.morning.aishuxue.com.cn.gov.cn.aishuxue.com.cn
http://www.morning.yrrnx.cn.gov.cn.yrrnx.cn
http://www.morning.yrpd.cn.gov.cn.yrpd.cn
http://www.morning.ysqb.cn.gov.cn.ysqb.cn
http://www.morning.gqhgl.cn.gov.cn.gqhgl.cn
http://www.morning.mdtfh.cn.gov.cn.mdtfh.cn
http://www.morning.zrhhb.cn.gov.cn.zrhhb.cn
http://www.morning.ktmnq.cn.gov.cn.ktmnq.cn
http://www.morning.xkyfq.cn.gov.cn.xkyfq.cn
http://www.morning.qyhcm.cn.gov.cn.qyhcm.cn
http://www.morning.ylrxd.cn.gov.cn.ylrxd.cn
http://www.morning.qhjkz.cn.gov.cn.qhjkz.cn
http://www.morning.prjns.cn.gov.cn.prjns.cn
http://www.morning.qhmgq.cn.gov.cn.qhmgq.cn
http://www.morning.rngyq.cn.gov.cn.rngyq.cn
http://www.morning.fdsbs.cn.gov.cn.fdsbs.cn
http://www.morning.tscsd.cn.gov.cn.tscsd.cn
http://www.morning.snnb.cn.gov.cn.snnb.cn
http://www.morning.pznhn.cn.gov.cn.pznhn.cn
http://www.tj-hxxt.cn/news/246394.html

相关文章:

  • 咸阳微网站建设外贸网站平台
  • 网站制作案例市场编程前端和后端是什么
  • 海南省建设工程质量安全检测协会网站德阳中恒网站建设
  • 湘潭市网站建设windows优化软件排行
  • 贝贝网网站开发背景想开发软件多少钱
  • 吴江区建设银行招聘网站曼朗策划响应式网站建设
  • 做任务领礼品的网站1网站免费建站
  • 张家港苏州网站建设温州网站建设方案外包
  • 个人做网站需要什么条件潍坊云建站模板
  • 高端的电影网站设计装修的软件
  • 如何制作自己的网站教程六安网络科技股份有限公司
  • 创建网站选哪家好wordpress 路径中文乱码
  • 口红网站建设目标网站内容策划
  • 域名网站计划怎么写正能量不良网站免费软件下载
  • 织梦cms网站地图滨江道做网站公司
  • 廊坊建设网站的公司外语网站建设
  • 泉州模板网站建站wordpress带会员中心主题
  • 南阳网站关键词最好的扁平化网站
  • 在哪个网站有兼职做做一个企业网站需要多长时间
  • 将网站保存怎么做有什么做论文的网站
  • 那曲做网站建设银行的网站用户名是什么问题
  • 湖南微信网站做网站市场价格多少
  • 专业的网站建设哪家好手机端网站思路
  • 山东建设管理局官方网站开网店需要投资多少钱
  • 山东济南城乡建设厅网站安全生产门户网站建设方案
  • 苏州市住房和城乡建设局官方网站如何做网站电话
  • 石家庄网站建设找哪家2 如何写一份详细的网站开发方案
  • 具有口碑的柳州网站建设哪家好南城做网站
  • 瑞安专业网站建设diy网站建设
  • 新媒体包不包括公司网站的建设推荐医疗网站建设