zoukankan      html  css  js  c++  java
  • 小程序实现选项卡效果代码

    //test.wxml
    <
    view class='h_ctr4 bc_white'> <view bindtap='xuan' data-num="1" data-id='zuijin' class="{{_num == 1 ? 'isxuan':'xuan'}}">全部</view> <view bindtap='xuan' data-num="2" data-id='zuigao' class="{{_num == 2 ? 'isxuan':'xuan'}}">未使用</view> <view bindtap='xuan' data-num="3" data-id='quanbu' class="{{_num == 3 ? 'isxuan':'xuan'}}">已使用</view> </view>
    //test.wxss
    /*
    选项卡*/ .h_ctr4 { width: 100%; height: 75rpx; line-height: 75rpx; font-size: 30rpx; margin-top: 0rpx; display: flex; } .xuan{ width: 250rpx; text-align: center; color: #333333; } .isxuan{ text-align: center; width: 250rpx; border-bottom: 10rpx solid #b4282d; color: #b4282d; }
    //test.js
    Page({
    /** * 页面的初始数据 */ data: { _num: 1, //这是点击选项卡参数,不是接口不需要传值 }, //点击切换距离、销量、全部店铺 xuan: function (e) { var that = this; this.setData({ _num: e.target.dataset.num }) var id = e.currentTarget.dataset.id; if (id == "zuijin") { wx.request({ // url: 'https://ceshi23.acorntimes.com/a/gongsi_zuijin.json', // url: 'http://192.168.199.181/a/gongsi_zuijin.json', url: rootDocment + '/a/gongsi_zuijin.json', data: { id: id }, method: 'POST', header: {}, success: function (res) { that.setData({ shops: res.data.data.shops }); } }) } if (id == "zuigao") { wx.request({ // url: 'https://ceshi23.acorntimes.com/a/gongsi_zuijin.json', // url: 'http://192.168.199.181/a/gongsi_zuijin.json', url: rootDocment + '/a/gongsi_zuigao.json', data: { id: id }, method: 'POST', header: {}, success: function (res) { that.setData({ shops: res.data.data.shops }); } }) } if (id == "quanbu") { wx.request({ // url: 'https://ceshi23.acorntimes.com/a/gongsi_zuijin.json', // url: 'http://192.168.199.181/a/gongsi_zuijin.json', url: rootDocment + '/a/gongsi_quanbu.json', data: { id: id }, method: 'POST', header: {}, success: function (res) { that.setData({ shops: res.data.data.shops }); } }) } }, })
  • 相关阅读:
    git hub 资料汇总
    java 实例化是调用了子类重写方法
    java接口示例
    cumber + selenium +java自动化测试
    解决selenium 启动ie浏览器报错:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones
    springmvc 数据回显功能
    springmvc管理资源开放
    springmvc 中controller与jsp传值
    springmvc注解事例
    springmvc
  • 原文地址:https://www.cnblogs.com/shark1100913/p/8491676.html
Copyright © 2011-2022 走看看