亚洲天堂色av_香蕉黄色一级片_蜜臀av网站_国产足控福利视频一区_久久av伊人_av网址在线

18842388900

網站建設 APP開發 小程序

Article/文章

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

您當前位置>首頁 > 知識 > 軟件開發

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

發表時間:2019-05-20 08:50:48

文章來源:沈陽網站建設

標簽:html5

分享:

瀏覽次數:0

本篇文章給大家帶來的內容是關于小程序自定義組件的實現方法(代碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。

2114713864-5b9b3b8856d4e_articlex.png
File:threecolgrid.js

// components/threeColumnGrid/threecolgrid.jsComponent({  /**   * 組件的屬性列表   */  properties: {    // 傳入的數據    booksData:{      type: Array,      value:[]    },    // grid的外邊距    mainMargin:{      type: Number,      value: 5    },    // grid的內邊距    mainPadding:{      type:Number,      value:10    },    // 行間距    rowSpace:{      type:Number,      value:20    },    // 列間距    colSpace:{      type:Number,      value:7    }  },  /**   * 組件的初始數據   */  data: {  },  /**   * 組件的方法列表   */  methods: {    checkIn:function(e){      console.log(e.currentTarget.dataset)      // 觸發action事件,triggerEvent函數接受三個值:事件名稱、數據、選項值        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;  /* 調節圖書列 */  /* 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;  /* 調節圖書列 */  /* 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軟件開發

<a href=http://www.m.hfbzsm.cn target=_blank class=infotextkey>沈陽<a href=http://www.m.hfbzsm.cn target=_blank class=infotextkey>軟件開發</a></a>,<a href=http://www.m.hfbzsm.cn target=_blank class=infotextkey>沈陽<a href=http://www.m.hfbzsm.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;}

使用組件

  //事件處理函數  getCheckValues: function(e){    console.log('checkbox發生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

相關案例查看更多

主站蜘蛛池模板: 三年片在线观看免费观看高清动漫 | 影音先锋资源爱色 | 欧美性生交XXXXX久久久缅北 | 噼里啪啦免费看 | 久久精品中文騷妇女内射 | 九九精品视频在线观看 | 成人拍拍拍在线观看 | 啪啪亚洲精品 | 国产精品免费一区二区三区四区 | 爱弓凉在线视频一区二区 | www.色涩涩 | 少妇被多人C夜夜爽爽AV | 一级做性色a爱片久久毛片欧 | 无码国产色欲XXXX视频 | 精品1区二区| 日本xxx裸体xxxx偷窥 | av色国产色拍 | 女人与公拘交酡全过女免费 | 艳妇臀荡乳欲伦岳动漫h | 黄色污污视频网站在线观看 | 欧美午夜性 | 日韩激情片免费 | 日韩成人av影院 | 裸体黄色片 | 一级少妇淫片 | 日韩精品中文字幕有码无码 | 特级小箩利无码毛片 | 曰韩免费无码AV一区二区 | 久久爱theporn| 九九热这里只有在线精品视 | 国产精品综合久久第一页 | 亚洲欧洲免费观看 | 国产高清第一页 | 国产视频一二 | 精品中国亚洲 | 地狱究竟有几层无删版免费观看 | 网站无需付费在线看视频 | 国产视频一区二区三区四区五区 | 国产福利精品在线观看 | 6080YYY午夜理论片无码 | 国产免费拔擦拔擦8x高清在线人 |