博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
微信小程序--问题汇总及详解之tab切换
阅读量:7243 次
发布时间:2019-06-29

本文共 3148 字,大约阅读时间需要 10 分钟。

设置背景颜色就直接在page里设置    page {background-color: rgb(242, 242, 242);}

tab切换:

navigator 页面链接

传参的格式为url="路径?title={

{item.title}}"   多个用&&连接

下个页面接收参数:

wxml:

进行中
已完成
{ {item.act_name}}
{ {item.pro_name}}
添加项目

wxss:

page {
background-color: rgb(242, 242, 242); /*设置背景颜色就直接在page里设置*/}.container {
width: 100%;}.swiper-tab {
width: 84%; text-align: center; line-height: 60rpx; margin-top: 40rpx; margin-bottom: 20rpx; border: 2rpx solid #1c7bf3; border-radius: 6rpx;}.swiper-tab-list {
font-size: 28rpx; display: inline-block; width: 50%; float: left; color: #1c7bf3;}.on {
color: #fff; background-color: #1c7bf3; box-shadow: 0 0 20rpx #d1e5fd;}.swiper-box {
display: block; height: 100%; width: 100%; overflow: hidden;}image {
width: 140rpx; height: 140rpx; display: inline-block; overflow: hidden; border-radius: 100%; float: left; margin-top: 36rpx; margin-left: 26rpx; margin-right: 30rpx;}.content {
width: 94%; height: 220rpx; box-shadow: 0 0 20rpx #bbb; margin: auto; margin-top: 22rpx; line-height: 220rpx; font-size: 32rpx; margin-left: 3%; background: #fff; border-radius: 8rpx;}.content>view {
float: left;}.txt1 {
color: #ff5438;}.hb {
text-align: center; margin-top:70rpx; font-size: 28rpx; width: 100%; margin-left:36%;}.text2 {
color: #bbb; float: left;}view {
display: inline-block;}

js:

/*获取系统信息*/    wx.getSystemInfo({
success: function (res) { that.setData({ winWidth: res.windowWidth, winHeight: res.windowHeight }); } }) }, /** 滑动切换tab **/ bindChange: function (e) {
var that = this; that.setData({ currentTab: e.detail.current }); }, /** 点击tab切换 **/ swichNav: function (e) {
var that = this; if (this.data.currentTab === e.target.dataset.current) { return false; } else {
that.setData({ currentTab: e.target.dataset.current }) } },
var app = getApp()Page({  data: {    winWidth: 0,  /* 页面配置*/    winHeight: 0,    currentTab: 0,   // tab切换      oneList: [{     //遍历数组,前台需要请求遍历的参数      id: '',      act_pic:'',      act_name: '',      pro_name: '',    }],  },//获取点击的产品ID,并保存在本地缓存   (进行中)  bindIndexId: function (e) {    var indexId = e.currentTarget.dataset.indexId    wx.setStorageSync('indexId', indexId)  },onLoad: function () {    var that = this;    var tokend = wx.getStorageSync('tokend') //取token    //刷新页面后得到进行中的数据    wx.request({      method: 'GET',      url: 'https://....?token=' + tokend,      header: {
'content-type': 'application/json'}, data: {}, success: function (res) { // success console.log(res) that.setData({ //将后台数值与前台数组匹配(集合) loadingList: res.data.data }) } });

转载于:https://www.cnblogs.com/JinQing/p/6673321.html

你可能感兴趣的文章
如何统一设置所有WebPart的标题栏的背景颜色
查看>>
Flex与.NET互操作(二):基于WebService的数据访问(上)
查看>>
utf-8编码的mysql数据库 按照 中文来对 名称进行排序
查看>>
smarty if 操作符
查看>>
python 自定义异常
查看>>
nullnullAS 数组
查看>>
linux命令综合
查看>>
Xcode 调试技巧
查看>>
Clojure常用模块
查看>>
会计基础第二次模拟试题(1)
查看>>
C#线程间同步无法关闭
查看>>
Win7与Ubuntu双系统安装过程
查看>>
HBase之五:hbase的region分区
查看>>
Android 多用户多缓存的简单处理方案
查看>>
Linux&shell 之Linux文件权限
查看>>
oracle expdp和impdp使用例子
查看>>
JavaScript —— 局部变量和全局变量
查看>>
通过qsort(void * lineptr[], int left, int rifht, int (*comp)(void *, void *))解读指针函数和void指针...
查看>>
大学该怎么度过
查看>>
Windows服务创建及安装
查看>>