• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

小程序 弹框修改+切换

原作者: [db:作者] 来自: [db:来源] 收藏 邀请


效果图:

   <swiper current="{{currentTab}}" duration="300"  bindchange="swiperTab">
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
        <swiper-item catchtouchmove="stopTouchMove">
            <view class="catalog_items display-flex-row" >
              <block wx:for="{{catalogs}}">
                <text data-select="{{item.select}}" class="{{item.select == catalogSelect ? 'active':''}} catalog_item" bindtap="chooseCatalog">{{item.catalogName}}</text>
              </block>
            </view>
        </swiper-item>
    </swiper>
  </view> 

css样式::
.show-btn {
margin-top: 100rpx;
color: #22cc22;
}

.modal-mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
opacity: 0.5;
overflow: hidden;
z-index: 9000;
color: #fff;
}

.modal-dialog {
width: 100%;
position: absolute;
bottom:0;
left: 0;
z-index: 9999;
background: #f9fbff;

}
.modal-title {
line-height:96rpx;
font-size: 32rpx;
color: #030303;
text-align: center;
border-bottom: 1px solid #ccc;
}
.modal-title1 {
line-height:96rpx;
font-size: 32rpx;
color: #030303;
padding-left:60rpx;
border-bottom: 1px solid #ccc;
}

.input {
width: 100%;
height: 82rpx;
font-size: 28rpx;
line-height: 28rpx;
padding: 0 20rpx;
box-sizing: border-box;
color: #333;
}

input-holder {
color: #666;
font-size: 28rpx;
}

.modal-footer {
display: flex;
flex-direction: row;
height: 86rpx;
border-top: 1px solid #dedede;
font-size: 34rpx;
line-height: 86rpx;
}

.btn-cancel {
width: 50%;
color: #666;
text-align: center;
border-right: 1px solid #dedede;
}

.btn-confirm {
width: 50%;
color: #ec5300;
text-align: center;
}
.modal-inpt{
width: 100%;
height: 100%;
position: relative;
}

.swiper-tab{
width: 100%;
text-align: center;
height:100%;
line-height: 70rpx;
/* display: flex; */
flex-flow: row;
justify-content: space-between;
position: relative;
font-size:15px;

}
.swiper-tab-item{
width: 48%;
color:#434343;
border: 1px solid #ccc;
border-top:none;
}
.active{
color:#59B550;
background: #fff;
border-right:10rpx solid #fff;

}
swiper{
/* text-align: center; /
display: block;
position: absolute;
right:0rpx;
top: 0rpx;
/
background: red; */
width: 51.6%;
height: 100%;
background: #fff;
}
.catalog_item{
display: block;
width: 100%;
margin: 34rpx;
font-size: 30rpx;
}

js::
Page({
data: {
showModal: false,
currentTab: 0,
catalogs: [
{
“catalogName”: “上午”,
“select”: 1
},
{
“catalogName”: “下午”,
“select”: 2
}
],
catalogSelect: 0,//判断是否选中
},
chooseCatalog: function (data) {
var that = this;
that.setData({//把选中值放入判断值
catalogSelect: data.currentTarget.dataset.select,
showModal: false
})

},
onLoad: function (options) {
},
swiperTab: function (e) {
var that = this;
that.setData({
currentTab: e.detail.current
});
},
clickTab: function (e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current,
catalogSelect: 0
})
}
},
stopTouchMove: function () {
return false; //防止swiper滑动
},
/**

  • 弹窗
    /
    showDialogBtn: function () {
    this.setData({
    showModal: true
    })
    },
    /
    *
  • 弹出框蒙层截断touchmove事件
    /
    preventTouchMove: function () {
    },
    /
    *
  • 隐藏模态对话框
    /
    hideModal: function () {
    this.setData({
    showModal: false
    });
    },
    /
    *
  • 对话框取消按钮点击事件
    /
    onCancel: function () {
    this.hideModal();
    },
    /
    *
  • 对话框确认按钮点击事件
    */
    onConfirm: function () {
    this.hideModal();
    }
    })

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
QT整人小程序发布时间:2022-07-18
下一篇:
手机记账小程序开发有哪些功能?发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap