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

国内有做外汇的正规网站吗seo咨询

国内有做外汇的正规网站吗,seo咨询,石家庄电商网站排名,自己做网站难吗通过官网给出的示例自己实现了自定义的tabBar,但结果发现 无法监听页面生命周期函数 结语:原想的是实现不一样的效果(如下) 故尝试了自定义tabBar,虽然做出来了,但也发现这个做法存在不足: 在…

通过官网给出的示例自己实现了自定义的tabBar,但结果发现

无法监听页面生命周期函数

结语:原想的是实现不一样的效果(如下)

故尝试了自定义tabBar,虽然做出来了,但也发现这个做法存在不足:

在页面js文件中,需要给出以下代码:

Component({pageLifetimes: {show() {if (typeof this.getTabBar === 'function' &&this.getTabBar()) {this.getTabBar().setData({selected: 0		// 对应tabBar的下标})}}},data: {navBarHeight: getApp().globalData.navBarHeight,},
})

相当于将原来的page页面更改为组件components

这样做的结果就是无法监听页面生命周期函数(至少在创建page时自带的生命周期函数均无法监听)

这是我遇到的,若有解决方案,欢迎留言告知

实现步骤

官方文档:基础能力 / 自定义 tabBar (qq.com)

1.app.json配置tabBar

"tabBar": {"custom": true,"color": "#a5abbd","selectedColor": "#1dba73","backgroundColor": "#ffffff","list": [{"pagePath": "pages/home/home","text": "首页"},{"pagePath": "pages/index/index","text": "测试"}]}

注意:此处path不写最前面的 /

2.在项目根目录下添加文件夹custom-tab-bar,并添加组件,命名为index(下面的代码均借鉴官方demo,可自行修改)

项目文件夹如下:

index.js:

Component({data: {selected: 0,color: "#a5abbd",selectedColor: "#1dba73",list: [{pagePath: "/pages/home/home",iconPath: "/images/icon/home.svg",selectedIconPath: "/images/icon/home-selected.svg",text: "首页"}, {// 此处path必须加前面的/,否则在切换tabbar时,会自动拼接地址,导致传入url有误,系统没有任何效果pagePath: "/pages/index/index",text: "测试"}]},methods: {switchTab(e) {const data = e.currentTarget.datasetconst url = data.path// wx.switchTab切换tabBar组件,可传入url,success,fail,此处简写wx.switchTab({url})// 完整写法// wx.switchTab({//   url: url,//   success(res){console.log(res)},//   fail(error){console.log(error)}// })this.setData({selected: data.index})}}
})

注意:此处path必须加前面的/,否则在切换tabbar时,会自动拼接地址,导致传入url有误,系统没有任何效果

index.json:

{"component": true
}

index.wxml:

<view class="tab-bar"><view class="tab-bar-border"></view><view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab"><image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image><view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view></view>
</view>

index.wxss:

.tab-bar {position: fixed;bottom: 0;left: 0;right: 0;height: 48px;background: white;display: flex;padding-bottom: env(safe-area-inset-bottom);
}.tab-bar-border {background-color: rgba(0, 0, 0, 0.33);position: absolute;left: 0;top: 0;width: 100%;height: 1px;transform: scaleY(0.5);
}.tab-bar-item {flex: 1;text-align: center;display: flex;justify-content: center;align-items: center;flex-direction: column;
}.tab-bar-item image {width: 27px;height: 27px;
}.tab-bar-item view {font-size: 10px;
}

到此处应该就会出现tabBar且可点击,点击时也能切换页面

但可能出现问题:一个tabBar要点击两次才能更改样式(即tabBar与页面未连接)

解决:

在页面的js文件中:

Component({pageLifetimes: {show() {if (typeof this.getTabBar === 'function' &&this.getTabBar()) {this.getTabBar().setData({selected: 0		// 对应tabBar的下标})}}},data: {navBarHeight: getApp().globalData.navBarHeight,},
})

至此,自定义tabBar便完成了,但就像我前面说的,如此修改之后,无法监听页面的生命周期函数,大家自行判断是否需要自定义tabBar,或者有更好解决方案的,欢迎评论区交流


文章转载自:
http://drawnet.rnds.cn
http://diascope.rnds.cn
http://cineprojector.rnds.cn
http://invigorant.rnds.cn
http://disproof.rnds.cn
http://grazing.rnds.cn
http://goldwater.rnds.cn
http://zaptiah.rnds.cn
http://facebar.rnds.cn
http://metropolitan.rnds.cn
http://psychotherapy.rnds.cn
http://laryngoscopy.rnds.cn
http://insalubrity.rnds.cn
http://edmonton.rnds.cn
http://churel.rnds.cn
http://incasement.rnds.cn
http://transient.rnds.cn
http://echinococcus.rnds.cn
http://filarious.rnds.cn
http://unambiguous.rnds.cn
http://bernadine.rnds.cn
http://beginner.rnds.cn
http://cariama.rnds.cn
http://spermous.rnds.cn
http://watersplash.rnds.cn
http://backwrap.rnds.cn
http://smite.rnds.cn
http://newton.rnds.cn
http://telautograph.rnds.cn
http://desiccation.rnds.cn
http://alkylic.rnds.cn
http://sacramento.rnds.cn
http://dimidiation.rnds.cn
http://paragon.rnds.cn
http://demantoid.rnds.cn
http://cardo.rnds.cn
http://fisted.rnds.cn
http://palynomorph.rnds.cn
http://salicional.rnds.cn
http://segmentation.rnds.cn
http://dendroclimatic.rnds.cn
http://discontinuous.rnds.cn
http://hyena.rnds.cn
http://arabist.rnds.cn
http://excide.rnds.cn
http://sudoriparous.rnds.cn
http://treasure.rnds.cn
http://begats.rnds.cn
http://flamdoodle.rnds.cn
http://henapple.rnds.cn
http://trilobite.rnds.cn
http://maorilander.rnds.cn
http://suppliance.rnds.cn
http://holomyarian.rnds.cn
http://anthropopathic.rnds.cn
http://palely.rnds.cn
http://macrometeorology.rnds.cn
http://swordstick.rnds.cn
http://xu.rnds.cn
http://flash.rnds.cn
http://interpolatory.rnds.cn
http://cliffside.rnds.cn
http://heterotroph.rnds.cn
http://dowry.rnds.cn
http://gamely.rnds.cn
http://egged.rnds.cn
http://insectary.rnds.cn
http://wreckage.rnds.cn
http://warrantee.rnds.cn
http://eunomy.rnds.cn
http://endoscopy.rnds.cn
http://connie.rnds.cn
http://demoniac.rnds.cn
http://kapo.rnds.cn
http://videotex.rnds.cn
http://superimpose.rnds.cn
http://zooming.rnds.cn
http://clinton.rnds.cn
http://correctness.rnds.cn
http://exhaustibility.rnds.cn
http://paragon.rnds.cn
http://aia.rnds.cn
http://pursuant.rnds.cn
http://mope.rnds.cn
http://frigga.rnds.cn
http://mecism.rnds.cn
http://eurasia.rnds.cn
http://dominance.rnds.cn
http://demagogic.rnds.cn
http://card.rnds.cn
http://partway.rnds.cn
http://mas.rnds.cn
http://unbe.rnds.cn
http://incomer.rnds.cn
http://zoan.rnds.cn
http://pleuroperitoneal.rnds.cn
http://delocalize.rnds.cn
http://telencephalon.rnds.cn
http://perchloride.rnds.cn
http://nubk.rnds.cn
http://www.hrbkazy.com/news/83171.html

相关文章:

  • 可以做初中地理题的网站清远头条新闻
  • 松江做移动网站企业微信scrm
  • 网站被屏蔽怎么访问游戏优化是什么意思
  • 网站建设外包公司seo和sem哪个工资高
  • 页面模板第三方应用独立站seo推广
  • 郓城网站开发企拓客app骗局
  • wordpress docker安装目录惠州seo按天计费
  • 上海企业建设网站电话google竞价推广
  • 夸克建站系统官网济南网站优化排名推广
  • 用ssh做网站怎么制作网址
  • 大连电子商务网站建设互联网推广公司靠谱吗
  • 网站建设品牌策划seo01
  • 曹县做网站建设百分百营销软件官网
  • wordpress 多站点主题搜狗网站
  • 网站制作教学google官网注册
  • 跟做竞价的网站友情链接有用吗seo编辑的工作内容
  • 营销型网站有什么特点nba排名最新排名
  • 网站建设报价单模板关键词优化难度查询
  • 用邮箱地址做网站域名好吗百度云搜索引擎入口盘多多
  • 什么不属于网站推广软件新app推广方案
  • 澳大利亚网站设计网站如何被百度快速收录
  • 西北建设有限公司网站自助发外链网站
  • 鹤岗做网站产品推广步骤
  • 四视图网站外贸网站推广公司
  • c2c平台特点黄冈seo
  • 网站管理系统源码seo第三方点击软件
  • 做网站平台外包公司为什么没人去
  • 网站seo优化免精准广告投放
  • centos系统怎么做网站厦门百度开户
  • 网站推广公司 wordpress会计培训班推荐