E企盈小程序营销工具技术服务商 热线:4006-838-530

微信小程序开发动态北京直播系统开发横向导航模板快速开发教程

E企盈小程序直播系统

使用scroll-view组件,可实现横向滚动功能。scroll-view内包含一个动态的view列表,代表导航的每一项,导航要接收动态数组,然后使用列表展示。使用模板技术做到可复用。 按照思路,先要做个template。 新建一个wxml文件:navbar.wxml {{item.name}} 再建相应的wxss文件:navbar.wxss .navbar{ background: #eeeeee; white-space: nowrap; } .navbar .item{ margin: 20rpx; display: inline-block; } .navbar .item.active{ color: #0000ff; font-weight:800; } 这样一个导航模板就创建好了。 接着在自己的页面中使用这个模板。 建议页面:index 在index.wxml中使用模直播聊天系统开发–开发热线:4006-838-530板: 这里要注意src的路径要找对,data参数名称也要与模板里一致。 接着在index.wxss中使用模板样式: @import /template/navbar.wxss; 引入这么一句就行了。 然后在index.js中绑定数据: Page({ /** * 页面的初始数据 */ data: { menus: [ { id:0, name: \’水果\’ }, { id:1, n直播课堂系统开发–开发热线:4006-838-530ame: \’水果\’ }, { id:2, name: \’一线海景\’ }, { id:3, name: \’水果\’ }, { id:4, name: \’水果\’ }, { id:5, name: \’一线海景\’ }, { id: 6, name: \’一线海景\’ }, { id: 7, name: \’水果\’ }, { id: 8, name: \’水果\’ }, { id: 9, name: \’一线海景\’ } ], currentTab: 0 }, navbarTap: function (e) { this.setData({ currentTab: e.currentTa直播视频直播系统开发–开发热线:4006-838-530rget.id }); console.log(e); } }) 运行结果: 相关资讯:微信小程序微信小程序开发教程

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序开发动态北京直播系统开发横向导航模板快速开发教程
分享到: 更多 (0)
E企盈小程序直播营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏