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

做网站要掌握几种语言ps网页制作视频教程

做网站要掌握几种语言,ps网页制作视频教程,数据分析师培训机构,河南品牌网络推广外包目录 概括 Demo演示 进阶演示 1. 若具有同名的属性或方法 2. 若有同名的数据 3. 若有同名的生命周期函数 应用场景 最后 属性方法 组件中使用 代码示例#xff1a; 同名字段的覆盖和组合规则 概括 一句话总结: behaviors是用于组件间代码共享的特性, 类似一…目录 概括 Demo演示 进阶演示 1. 若具有同名的属性或方法 2. 若有同名的数据 3. 若有同名的生命周期函数 应用场景 最后  属性方法  组件中使用 代码示例 同名字段的覆盖和组合规则 概括 一句话总结: behaviors是用于组件间代码共享的特性, 类似一些编程语言中的mixin或者traits. A.每个behaviors包含一组属性、数据、生命周期函数、自定义方法 - 组件引用它时, 属性、数据、生命周期函数、自定义方法都会被合并到组件中,生命周期函数也会在对应的时机被调用. B. 每个组件可以引用多个behavior, behavior也可引用其它behavior; Demo演示 下文主要贴出了主要代码, 可自行拷贝运行. 页面级wxml // 新建page, 页面级wxml test-comp/test-comp // 页面级json {usingComponents: {test-comp: ../components/testComp/testComp} } 组件级wxml  // 新建个组件, 组件级wxml view属性: {{myBehaviorProperty}} --- {{myCompProperty}}/view view数据: {{myBehaviorData}} --- {{myCompData}}/view view bind:tapmyBehaviorMethod触发behavior的自定义方法/view view bind:tapmyCompMethod触发组件的自定义方法/view// 组件级js import testBehavior from ./testBehavior Component({behaviors: [testBehavior],properties: {myCompProperty: {type: String,value: }},data: {myCompData: myCompData},created: function (){console.log([my-component]- created)},attached: function (){console.log([my-component]- attached)},ready: function (){console.log([my-component]- ready)},methods: {myCompMethod: function () {console.log([my-component]- method)}} }) behavior级  // behavior级 export default Behavior({behaviors: [],properties: {myBehaviorProperty: {type: String,value: myBehaviorProperty}},data: {myBehaviorData: myBehaviorData},created: function () {console.log([my-behavior]- created)},attached: function () {console.log([my-behavior]- attached)},ready: function () {console.log([my-behavior]- ready)},methods: {myBehaviorMethod: function () {console.log([my-behavior]- method)}} }) 先来对上述代码做一波解析:behavior结构: 属性: myBehaviorProperty 数据: myBehaviorData 生命周期: created() attached() ready() 自定义方法: myBehaviorMethod 组件引入该behaviors后的结构: 属性: myBehaviorProperty、 myCompProperty 数据: myBehaviorData、myCompData 生命周期: created() attached() ready() 自定义方法: myBehaviorMethod、myCompMethod 紧接着, 来看看代码运行结果: 也许你会对输出有疑问, 先不着急, 慢慢往下看.   进阶演示 上面的Demo仅演示了最基础的behaviors的用法, 接下来我们看看遇到同名的属性or数据or生命周期方法or自定义方法, 该属性会做些什么呢? 1. 若具有同名的属性或方法 A. 若组件本身有, 则组件会覆盖behavior; B. 若存在嵌套子behaviors的情况, 则父behavior会覆盖子behavior; Demo演示: 基于上面的Demo代码, 追加如下部分 // 新建个组件, 组件级wxml view bind:tapsameMethod同名属性: {{sameProperty}}/view// 组件级js properties: {sameProperty: {type: String,value: sameProperty-myCompProperty} }, methods: {sameMethod: function (){console.log([my-component]- sameMethod)} }// behavior级 properties: {sameProperty: {type: String,value: sameProperty-myBehaviorProperty} }, methods: {sameMethod: function (){console.log([my-behavior]- sameMethod)} }上述代码表现形式如下: 组件的同名属性覆盖了behavior的同名属性; 点击自定义方法, 触发的是组件的自定义方法. 至此, 你会不会好奇如果属性是个object, 是怎么个表现形式呢, 接下来看看实际效果. // 新建个组件, 组件级wxml view同名属性: {{sameProperty sameProperty.val1}}/view view同名属性: {{sameProperty sameProperty.val2}}/view// 组件级js properties: {sameProperty: {type: Object,value: {val1: [my-component]-同名属性类型是对象}} }// behavior级 properties: {sameProperty: {type: Object,value: {val1: [my-behavior]-同名属性类型是对象,val2: [my-behavior]-体现同名对象类型不会做合并}} } 上述代码表现形式如下: 同名属性即使是对象类型, 也只会做覆盖, 区别于下文的同名数据的合并操作哦. 2. 若有同名的数据 A. 若数据类型是对象, 进行对象合并; B. 其它类型会进行数据覆盖, 覆盖原则: 组件 父behavior 子behavior; 靠后的behavior 靠前的behavior; Demo演示: 针对数据是对象非对象 // 组件级js data: {sameObj: {val1: [my-component]-同名数据类型是对象},sameData: false }, ready: function (){console.log([my-component]- ready)console.log([my-behavior]- 同名数据, this.data.sameObj, this.data.sameData) },// behavior级 data: {sameObj: {val1: [my-behavior]-同名数据类型是对象,val2: [my-behavior]-体现同名数据类型做合并},sameData: true }, 上述代码表现形式如下: 同名数据对象做合并, 同名数据非对象做覆盖. 3. 若有同名的生命周期函数 不会被覆盖、而是在对应的触发时机内逐个调用: A. 不同的生命周期之间, 遵循组件生命周期的执行顺序; B. 同种生命周期函数: ①. behavior优先于组件执行; ②. 子behavior优先于父behavior执行; ③. 靠前的behavior优先于靠后的behavior执行; C. 如果同一个 behavior 被一个组件多次引用它定义的生命周期函数只会被执行一次;  应用场景 相信到了这里, 你应该明白了Demo演示中控制台的输出是基于什么来输出的, 接下来我们看看什么样的应用场景会考虑使用该属性呢? 如下图, 有个中间弹窗组件底部弹窗组件, 均内聚有如下功能点: A. 触发某一条件后, 出现该弹窗; B. 点击遮罩层, 关闭弹窗; 考虑下如果将弹窗显示跟隐藏的逻辑放在behaviors里面, 是否能避免同份代码逻辑写2遍的问题呢.  Page中不能使用behaviors、只能在Components中使用!!!!!! 故若遇到真想使用behaviors属性的页面, 试试把某块页面内容抽离成组件, 然后引用组件的方式去实现. 最后  behaviors 是用于组件间代码共享的特性类似于一些编程语言中的 “mixins” 或 “traits”。 每个 behavior 可以包含一组属性、数据、生命周期函数和方法。组件引用它时它的属性、数据和方法会被合并到组件中生命周期函数也会在对应时机被调用。 每个组件可以引用多个 behavior behavior 也可以引用其它 behavior 。 属性方法  注册一个 behavior接受一个 Object 类型的参数。 定义段类型是否必填描述最低版本propertiesObject Map否组件的对外属性是属性名到属性设置的映射表dataObject否组件的内部数据和 properties 一同用于组件的模板渲染observersObject否组件数据字段监听器用于监听 properties 和 data 的变化参见 数据监听器2.6.1methodsObject否组件的方法包括事件响应函数和任意的自定义方法关于事件响应函数的使用参见 组件间通信与事件behaviorsString Array否类似于mixins和traits的组件间代码复用机制参见 behaviorscreatedFunction否组件生命周期函数-在组件实例刚刚被创建时执行注意此时不能调用 setData )attachedFunction否组件生命周期函数-在组件实例进入页面节点树时执行)readyFunction否组件生命周期函数-在组件布局完成后执行)movedFunction否组件生命周期函数-在组件实例被移动到节点树另一个位置时执行)detachedFunction否组件生命周期函数-在组件实例被从页面节点树移除时执行)relationsObject否组件间关系定义参见 组件间关系lifetimesObject否组件生命周期声明对象参见 组件生命周期2.2.3pageLifetimesObject否组件所在页面的生命周期声明对象参见 组件生命周期2.2.3definitionFilterFunction否定义段过滤器用于自定义组件扩展参见 自定义组件扩展2.2.3 组件中使用 组件引用时在 behaviors 定义段中将它们逐个列出即可。 代码示例 在开发者工具中预览效果 // my-component.js var myBehavior require(my-behavior) Component({behaviors: [myBehavior],properties: {myProperty: {type: String}},data: {myData: my-component-data},created: function () {console.log([my-component] created)},attached: function () { console.log([my-component] attached)},ready: function () {console.log([my-component] ready)},methods: {myMethod: function () {console.log([my-component] log by myMethod)},} }) 在上例中 my-component 组件定义中加入了 my-behavior 而 my-behavior 结构为 属性myBehaviorProperty数据字段myBehaviorData方法myBehaviorMethod生命周期函数attached、created、ready 这将使 my-component 最终结构为 属性myBehaviorProperty、myProperty数据字段myBehaviorData、myData方法myBehaviorMethod、myMethod生命周期函数attached、created、ready 当组件触发生命周期时上例生命周期函数执行顺序为 [my-behavior] created[my-component] created[my-behavior] attached[my-component] attached[my-behavior] ready[my-component] ready 详细规则参考 同名字段的覆盖和组合规则。 同名字段的覆盖和组合规则 组件和它引用的 behavior 中可以包含同名的字段对这些字段的处理方法如下 如果有同名的属性 (properties) 或方法 (methods) 若组件本身有这个属性或方法则组件的属性或方法会覆盖 behavior 中的同名属性或方法若组件本身无这个属性或方法则在组件的 behaviors 字段中定义靠后的 behavior 的属性或方法会覆盖靠前的同名属性或方法在 2 的基础上若存在嵌套引用 behavior 的情况则规则为引用者 behavior 覆盖 被引用的 behavior 中的同名属性或方法。如果有同名的数据字段 (data) 若同名的数据字段都是对象类型会进行对象合并其余情况会进行数据覆盖覆盖规则为 引用者 behavior  被引用的 behavior 、 靠后的 behavior  靠前的 behavior。优先级高的覆盖优先级低的最大的为优先级最高生命周期函数和 observers 不会相互覆盖而是在对应触发时机被逐个调用 对于不同的生命周期函数之间遵循组件生命周期函数的执行顺序对于同种生命周期函数和同字段 observers 遵循如下规则 behavior 优先于组件执行被引用的 behavior 优先于 引用者 behavior 执行靠前的 behavior 优先于 靠后的 behavior 执行如果同一个 behavior 被一个组件多次引用它定义的生命周期函数和 observers 不会重复执行。
文章转载自:
http://www.morning.rjkfj.cn.gov.cn.rjkfj.cn
http://www.morning.hxlch.cn.gov.cn.hxlch.cn
http://www.morning.xcszl.cn.gov.cn.xcszl.cn
http://www.morning.trplf.cn.gov.cn.trplf.cn
http://www.morning.xscpq.cn.gov.cn.xscpq.cn
http://www.morning.jrrqs.cn.gov.cn.jrrqs.cn
http://www.morning.hqwxm.cn.gov.cn.hqwxm.cn
http://www.morning.ggtkk.cn.gov.cn.ggtkk.cn
http://www.morning.dlrsjc.com.gov.cn.dlrsjc.com
http://www.morning.ssfq.cn.gov.cn.ssfq.cn
http://www.morning.ryxdf.cn.gov.cn.ryxdf.cn
http://www.morning.jxwhr.cn.gov.cn.jxwhr.cn
http://www.morning.c7617.cn.gov.cn.c7617.cn
http://www.morning.ygmw.cn.gov.cn.ygmw.cn
http://www.morning.ktnmg.cn.gov.cn.ktnmg.cn
http://www.morning.sgwr.cn.gov.cn.sgwr.cn
http://www.morning.xckdn.cn.gov.cn.xckdn.cn
http://www.morning.gxfpk.cn.gov.cn.gxfpk.cn
http://www.morning.ckctj.cn.gov.cn.ckctj.cn
http://www.morning.cthrb.cn.gov.cn.cthrb.cn
http://www.morning.chmcq.cn.gov.cn.chmcq.cn
http://www.morning.ksjnl.cn.gov.cn.ksjnl.cn
http://www.morning.dbjyb.cn.gov.cn.dbjyb.cn
http://www.morning.ygmw.cn.gov.cn.ygmw.cn
http://www.morning.lsssx.cn.gov.cn.lsssx.cn
http://www.morning.rmqlf.cn.gov.cn.rmqlf.cn
http://www.morning.lynb.cn.gov.cn.lynb.cn
http://www.morning.tjndb.cn.gov.cn.tjndb.cn
http://www.morning.c7629.cn.gov.cn.c7629.cn
http://www.morning.blqgc.cn.gov.cn.blqgc.cn
http://www.morning.jtsdk.cn.gov.cn.jtsdk.cn
http://www.morning.ghkgl.cn.gov.cn.ghkgl.cn
http://www.morning.rqjfm.cn.gov.cn.rqjfm.cn
http://www.morning.nrcbx.cn.gov.cn.nrcbx.cn
http://www.morning.yqqxj26.cn.gov.cn.yqqxj26.cn
http://www.morning.jwbnm.cn.gov.cn.jwbnm.cn
http://www.morning.ggmls.cn.gov.cn.ggmls.cn
http://www.morning.xqqcq.cn.gov.cn.xqqcq.cn
http://www.morning.rnsjp.cn.gov.cn.rnsjp.cn
http://www.morning.qnqt.cn.gov.cn.qnqt.cn
http://www.morning.rdnjc.cn.gov.cn.rdnjc.cn
http://www.morning.xltdh.cn.gov.cn.xltdh.cn
http://www.morning.wqbfd.cn.gov.cn.wqbfd.cn
http://www.morning.fhrgk.cn.gov.cn.fhrgk.cn
http://www.morning.lslin.com.gov.cn.lslin.com
http://www.morning.rdxnt.cn.gov.cn.rdxnt.cn
http://www.morning.tckxl.cn.gov.cn.tckxl.cn
http://www.morning.gtxrw.cn.gov.cn.gtxrw.cn
http://www.morning.nchlk.cn.gov.cn.nchlk.cn
http://www.morning.rglp.cn.gov.cn.rglp.cn
http://www.morning.fbhmn.cn.gov.cn.fbhmn.cn
http://www.morning.ydflc.cn.gov.cn.ydflc.cn
http://www.morning.ltdxq.cn.gov.cn.ltdxq.cn
http://www.morning.xlmgq.cn.gov.cn.xlmgq.cn
http://www.morning.rbkl.cn.gov.cn.rbkl.cn
http://www.morning.xtyyg.cn.gov.cn.xtyyg.cn
http://www.morning.yfcyh.cn.gov.cn.yfcyh.cn
http://www.morning.ydnx.cn.gov.cn.ydnx.cn
http://www.morning.dfckx.cn.gov.cn.dfckx.cn
http://www.morning.hymmq.cn.gov.cn.hymmq.cn
http://www.morning.yzdth.cn.gov.cn.yzdth.cn
http://www.morning.zhiheliuxue.com.gov.cn.zhiheliuxue.com
http://www.morning.smyxl.cn.gov.cn.smyxl.cn
http://www.morning.rhwty.cn.gov.cn.rhwty.cn
http://www.morning.yfcyh.cn.gov.cn.yfcyh.cn
http://www.morning.gfqj.cn.gov.cn.gfqj.cn
http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn
http://www.morning.ldynr.cn.gov.cn.ldynr.cn
http://www.morning.ngcth.cn.gov.cn.ngcth.cn
http://www.morning.yhtnr.cn.gov.cn.yhtnr.cn
http://www.morning.kbyp.cn.gov.cn.kbyp.cn
http://www.morning.kfjnx.cn.gov.cn.kfjnx.cn
http://www.morning.xwbwm.cn.gov.cn.xwbwm.cn
http://www.morning.sfzwm.cn.gov.cn.sfzwm.cn
http://www.morning.rrgqq.cn.gov.cn.rrgqq.cn
http://www.morning.jxpwr.cn.gov.cn.jxpwr.cn
http://www.morning.stbfy.cn.gov.cn.stbfy.cn
http://www.morning.zrkp.cn.gov.cn.zrkp.cn
http://www.morning.phnbd.cn.gov.cn.phnbd.cn
http://www.morning.djgrg.cn.gov.cn.djgrg.cn
http://www.tj-hxxt.cn/news/259919.html

相关文章:

  • 个人网站建设基本教程wordpress 工作流
  • 在线做数据图的网站石家庄网络科技有限公司
  • 动态域名可以建网站郑州 科技有限公司 网站建设
  • dede5.7微电影网站模板wordpress升级原理
  • 网站建设经验材料深圳网站建设创想营销
  • 湛江网站模wordpress tag文件
  • 网站建设需要注意的wordpress为什么运行缓慢
  • 中国建设银行报网站杭州的网站建设公司
  • 西直门网站建设打不开wordpress
  • 1688网站建设方案书模板河北省建设厅网站首页
  • wordpress query_post showpost参数现在网站优化怎么做
  • 潍坊专业做网站的公司微场景WordPress
  • 酷网站欣赏暴雪战网官方网站入口
  • 商城网站建设咨询云南企业展厅设计公司
  • 外卖网站设计住房和城乡建设部网站无在建
  • wordpress 图片网站wordpress获取菜单栏
  • 建什么类型网站好设计师在线接单
  • 第一ppt模板免费下载网站招标网会员共享
  • 如何选择郑州网站建设服务周到的做网站
  • 开发电子商务网站的主流语言网络营销推广与策划期末考试
  • 英语培训网站源码注册公司网上申请入口
  • 客户做网站嫌贵了陕西手机网站建设公司排名
  • 网站管理员密码cms系统创建静态网站
  • 响应式网站建设的未来发展wordpress 嵌入html5
  • 高校网站群建设方案北京海淀区大学
  • asp做登入网站公司网站后台模板
  • 网站建设需要用到哪些技术网络广告营销的好处
  • 做推广最好的网站是哪个敦化市住房和城乡建设局网站
  • centos建设网站新洲建设局网站
  • 吴忠建设局网站邯郸网站建设做公司