微信小程序:隐藏和显示功能

来源:互联网 发布:stl源码是什么 编辑:程序博客网 时间:2024/06/13 12:35

界面


app.js

Page({  data:{    showView:true  },  onLoad:function(options){    // 生命周期函数--监听页面加载    showView:(options.showView=="true"?true:false)  }  ,onChangeShowState:function(){    var that=this;    that.setData({      showView:(!that.data.showView)    })  }})
app.wxml

<viewclass="page">  <view >     <buttonbindtap="onChangeShowState">{{showView?'隐藏':'显示'}}</button>  </view>  <view class="bright789_view_hide{{showView?'bright789_view_show':''}}">    <textclass="bright789-text">我是被显示被隐藏控件</text>  </view></view>

app.wxss

.bright789-text{  font-size: 40rpx;  line-height: 40px;  color: #ff0000;}.bright789_view_hide{    display: none;}.bright789_view_show{    display: block;}




阅读全文
0 0
原创粉丝点击