国产三级韩国三级日产三级剧情_天天爱夜夜操_免费观看亚洲人成网站_超碰9999_精品伊人久久久大香线蕉天堂_深夜在线观看

18842388900

網(wǎng)站建設(shè) APP開發(fā) 小程序

Article/文章

記錄成長點滴 分享您我感悟

您當(dāng)前位置>首頁 > 知識 > 軟件開發(fā)

小程序自定義組件的實現(xiàn)方法(代碼)

發(fā)表時間:2019-05-20 08:50:48

文章來源:沈陽網(wǎng)站建設(shè)

標(biāo)簽:html5

分享:

瀏覽次數(shù):0

本篇文章給大家?guī)淼膬?nèi)容是關(guān)于小程序自定義組件的實現(xiàn)方法(代碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。

2114713864-5b9b3b8856d4e_articlex.png
File:threecolgrid.js

// components/threeColumnGrid/threecolgrid.jsComponent({  /**   * 組件的屬性列表   */  properties: {    // 傳入的數(shù)據(jù)    booksData:{      type: Array,      value:[]    },    // grid的外邊距    mainMargin:{      type: Number,      value: 5    },    // grid的內(nèi)邊距    mainPadding:{      type:Number,      value:10    },    // 行間距    rowSpace:{      type:Number,      value:20    },    // 列間距    colSpace:{      type:Number,      value:7    }  },  /**   * 組件的初始數(shù)據(jù)   */  data: {  },  /**   * 組件的方法列表   */  methods: {    checkIn:function(e){      console.log(e.currentTarget.dataset)      // 觸發(fā)action事件,triggerEvent函數(shù)接受三個值:事件名稱、數(shù)據(jù)、選項值        this.triggerEvent('action', e.currentTarget.dataset, {})     }  }})
<!--components/threeColumnGrid/threecolgrid.wxml--><!-- <view class='main-content'> -->  <view class='bookbox' style='padding:{{mainPadding}}rpx;margin:{{mainMargin}}rpx;'>    <block wx:for="{{booksData}}" wx:key="{{item.id}}">      <view class='bookinfo' style='margin-bottom: {{rowSpace}}rpx;'>        <image src='{{item.url}}' mode="widthFix" style='width:{{(740 - 2*mainPadding - 2*mainMargin)/3 - colSpace*3}}rpx;'></image>        <view class="title" style='width:{{(740 - 2*mainPadding - 2*mainMargin)/3 - colSpace*3}}rpx;'>{{item.title}}</view>        <view class='actionBar' style='width:{{(740 - 2*mainPadding - 2*mainMargin)/3 - colSpace*3}}rpx;'>          <block wx:if="{{item.status == 0}}">            <view class='bookstatus disable'>暫缺貨</view>            <view bindtap='checkIn' data-bookid='{{item.id}}' data-status='{{item.status}}' class='iconfont icon-219-heart icon'></view>          </block>          <block wx:else>            <view class='bookstatus enable'>可借閱</view>            <view bindtap='checkIn' data-bookid='{{item.id}}' data-status='{{item.status}}' class='iconfont icon-059-cart icon'></view>          </block>                  </view>      </view>    </block>  </view><!-- </view> -->
/* components/threeColumnGrid/threecolgrid.wxss */@import "../../iconfont.wxss";/* .main-content{  background: #FFF;  margin-top: 155rpx;  padding:10rpx;} */.bookbox{  display: flex;  flex-direction: row;  justify-content: space-between;  flex-wrap:wrap;  background: #FFF;}.bookbox .bookinfo{  display: flex;  flex-direction: column;  justify-content: center;  align-items: center;  /* border: 1rpx solid #f5a32d; */}.bookbox .bookinfo image{  display: flex;  /* 調(diào)節(jié)圖書列 */  /* width:220rpx;  */  border-top-left-radius: 10rpx;  border-top-right-radius: 10rpx}.bookbox .bookinfo .title{  display: flex;  flex-wrap: wrap;  font-size: small;  margin-bottom: 5rpx;  /* 調(diào)節(jié)圖書列 */  /* width:300rpx; */  /* width:220rpx; */  height: 70rpx;}.bookbox .bookinfo .actionBar{  display: flex;  justify-content: space-between;  align-items: center;  padding: 0rpx 5rpx 5rpx 5rpx;  font-size: smaller;  /* width:200rpx; */}.bookbox .bookinfo .actionBar .bookstatus{  display: flex;  border-radius: 10rpx;  padding:0rpx 5rpx;}.bookbox .bookinfo .actionBar .enable{  color: #FFF;  background-color: #f5a32d;}.bookbox .bookinfo .actionBar .disable{  color: #FFF;  background-c軟件開發(fā)

<a href=http://www.lglu.com.cn target=_blank class=infotextkey>沈陽<a href=http://www.lglu.com.cn target=_blank class=infotextkey>軟件開發(fā)</a></a>,<a href=http://www.lglu.com.cn target=_blank class=infotextkey>沈陽<a href=http://www.lglu.com.cn target=_blank class=infotextkey>軟件公司</a></a>

olor: #727171;}.bookbox .bookinfo .actionBar .icon{ font-size: 15pt; color: #facea7;}.bookinfo-empty{ display: flex; flex-direction: column; align-items: center; padding: 5rpx; width:230rpx;}

使用組件

  //事件處理函數(shù)  getCheckValues: function(e){    console.log('checkbox發(fā)生change事件,攜帶value值為:', e.detail)  },
{  "usingComponents": {    "three-col-grid":"/components/threeColumnGrid/threecolgrid"  },}
  <view class='test'>    <three-col-grid booksData="{{BookList}}" bind:action="getCheckValues"></three-col-grid>  </view>              
              

html5

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

主站蜘蛛池模板: 无码吃奶揉捏奶头高潮视频 | 日本xxxxx片免费 | 久久精品6 | 啪啪玩小处雏女 | 久久免费视频一区 | 免费亚洲视频 | 国产精品青青草 | 福利在线国产 | 好吊视频一区二区三区四区 | 日本高清视频在线观看 | 精品一区二区久久久久久久网站 | 国产aⅴ无码久久丝袜美腿 欧美人妻小说 | 中国农村一级毛片 | 日本黄色不卡 | 成人欧美一区二区三区视频不卡 | 亚洲成人精品视频 | 成年性羞羞视频免费观看无限 | sesese在线观看a片 | 美女把尿口扒开让男人桶 | 乱一色一乱一性一视频 | 午夜福利一区二区东京热 | 女人高潮叫床三级视频 | 免费高清特级毛片A片 | 日本精品少妇一区二区三区 | 日本色综合网 | 国产学生系列一区二区三区 | 公交车上~嗯啊被高潮视频软件 | 亚洲午夜无码毛片AV久久京东热 | 国产精品日韩一区二区免费视频 | 色眯眯av| 最新版天堂资源中文官网 | 精品超清无码视频在线观看 | 国产xxxxhd| 男男黄GAY片免费网站WWW | 日韩一区二区久久久 | 午夜国产视频精品久久 | 91精品?看| 亚洲一区二区三区四区的 | 国内精品视频久久 | 91综合久久婷婷久久 | a在线观看|