可以清楚的看出來圓圈的大小和字體的大小非常不協(xié)調(diào)。至于radio如何實現(xiàn)的,這里就不贅述了,大家可以在官方教程中學(xué)習(xí)簡易教程-小程序
這里的icon可以調(diào)整大小,調(diào)整位置。
<scroll-view hidden="{{hideArea}}" scroll-y="true" style="height: 100px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}"><view class="radio-group" ><label wx:for="{{areas}}" wx:for-item="area"><text bindtap="selectAreaOk" data-areaId="{{area.id}}">{{area.name}}</text> <icon wx:if="{{area.isSelect}}" type="success" size="10"/> <icon wx:else type="circle" size="10"/></label></view></scroll-view>先設(shè)定一個scroll-view,設(shè)置選擇框的父容器位置大小其中radio-group的wxss設(shè)定了容器內(nèi)字體大小已經(jīng)排練方式
根據(jù)area對象的isSelect屬性來確定顯示的< icon>,其中一個是圓圈,一個是綠色的對勾。示例中icon的大小設(shè)置為10,這里可以隨意改變其大小。
//選擇區(qū)域selectAreaOk: function(event){var selectAreaId = event.target.dataset.areaid;var that = thisareaId = selectAreaIdfor(var i = 0;i<this.data.areas.length;i++){if(this.data.areas[i].id==selectAreaId){this.data.areas[i].isSelect=true}else{this.data.areas[i].isSelect=false}}this.setData({areas:this.data.areas,skus:[],hideArea:true})getSkus(that,selectAreaId)}