你会实现一个微信小程序开关功能吗

wxml:

我是被隐藏控件

wxss:

.hide{

display: none;

}

.show{

display: block;

}

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)

})

}

})

另一种方式:

wxml:

js:

showView:true;

onChangeShowState: function () {

var that = this;

that.setData({

showView: (!that.data.showView)


。。。。。。。。。。。。。

作者:Vam的金豆之路

篇幅有限更多请见扩展链接:http://www.mark-to-win.com/tutorial/51000.html

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章