欧美三级国产三级日韩三级_亚洲熟妇丰满大屁股熟妇_欧美亚洲成人一区二区三区_国产精品久久久久久模特

小程序?qū)崿F(xiàn)展開(kāi)隱藏列表 - 新聞資訊 - 云南小程序開(kāi)發(fā)|云南軟件開(kāi)發(fā)|云南網(wǎng)站建設(shè)-昆明葵宇信息科技有限公司

159-8711-8523

云南網(wǎng)建設(shè)/小程序開(kāi)發(fā)/軟件開(kāi)發(fā)

知識(shí)

不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價(jià)值,我們?cè)谧非笃湟曈X(jué)表現(xiàn)的同時(shí),更側(cè)重于功能的便捷,營(yíng)銷的便利,運(yùn)營(yíng)的高效,讓網(wǎng)站成為營(yíng)銷工具,讓軟件能切實(shí)提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序?yàn)楹笃谏?jí)提供便捷的支持!

您當(dāng)前位置>首頁(yè) » 新聞資訊 » 小程序相關(guān) >

小程序?qū)崿F(xiàn)展開(kāi)隱藏列表

發(fā)表時(shí)間:2020-9-28

發(fā)布人:葵宇科技

瀏覽次數(shù):68

一、實(shí)現(xiàn)思路

用戶點(diǎn)擊wxml中的某個(gè)事件后,會(huì)觸發(fā)js中的函數(shù),該函數(shù)可以動(dòng)態(tài)修改css樣式,效果如圖所示。

二、代碼

wsml:

<view class='display-title' catchtap="showHidden" data-id="1">
		<image class="list-icon-left" src="../../images/list.png"></image><text class="title-text">宣傳教育</text>
		<image class="list-icon-right" src="{{arrow[0].url}}"></image>
	</view>
	<view class="{{arrow[0].css}}">
		<block wx:for="{{propagate}}" wx:key="index">
		<view wx:if="{{item.type == 1}}">
			<view class='text-content' catchtap="catchTapPropagate" data-id="{{item.id}}">{{item.title}}</view>
			</view>
		</block>
	</view>
	<view class='display-title' catchtap="showHidden" data-id="2">
		<image class="list-icon-left" src="../../images/list.png"></image><text class="title-text">法制法規(guī)</text>
		<image class="list-icon-right" src="{{arrow[1].url}}"></image>
	</view>
	<view class="{{arrow[1].css}}">
		<block wx:for="{{propagate}}" wx:key="index">
		<view wx:if="{{item.type == 2}}">
			<view class='text-content' catchtap="catchTapPropagate" data-id="{{item.id}}">{{item.title}}</view>
			</view>
		</block>
	</view>
	<view class='display-title' catchtap="showHidden" data-id="3">
		<image class="list-icon-left" src="../../images/list.png"></image><text class="title-text">案例警示</text>
		<image class="list-icon-right" src="{{arrow[2].url}}"></image>
	</view>
	<view class="{{arrow[2].css}}">
		<block wx:for="{{propagate}}" wx:key="index">
		<view wx:if="{{item.type == 3}}">
			<view class='text-content' catchtap="catchTapPropagate" data-id="{{item.id}}">{{item.title}}</view>
		</view>
		</block>
	</view>

js:

 data: {
    arrow:[{url:"../../images/down.png",css:"content-hidden",state:0},    
           {url:"../../images/down.png",css:"content-hidden",state:0}, 
           {url:"../../images/down.png",css:"content-hidden",state:0}],
}
showHidden: function (e) {
  var that=this
  var id = e.currentTarget.dataset.id;
  console.log(that.data.arrow)
  if(id==1){
    if(that.data.arrow[0].state==0){
      that.setData({
        'arrow[0].url':'../../images/up.png',
        'arrow[0].css':'content-show',
        'arrow[0].state':1,
      })
    }else{
      that.setData({
        'arrow[0].url':'../../images/down.png',
        'arrow[0].css':'content-hidden',
        'arrow[0].state':0,
      })
      }
  }else if(id==2){
    if(that.data.arrow[1].state==0){
      that.setData({
        'arrow[1].url':'../../images/up.png',
        'arrow[1].css':'content-show',
        'arrow[1].state':1,
      })
    }else{
      that.setData({
        'arrow[1].url':'../../images/down.png',
        'arrow[1].css':'content-hidden',
        'arrow[1].state':0,
      })
      }
  }else{
    if(that.data.arrow[2].state==0){
      that.setData({
        'arrow[2].url':'../../images/up.png',
        'arrow[2].css':'content-show',
        'arrow[2].state':1,
      })
    }else{
      that.setData({
        'arrow[2].url':'../../images/down.png',
        'arrow[2].css':'content-hidden',
        'arrow[2].state':0,
      })
      }
  }
},

wxss:

.content-hidden{
  width: 100%;
  font-size: large;
  font-family: Georgia, 'Times New Roman', Times, serif;
  display: none;
}
.content-show{
  width: 100%;
  font-size: large;
  font-family: Georgia, 'Times New Roman', Times, serif;
  display: block;
}

相關(guān)案例查看更多