找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

微信小程序实战商城系列《四》商品属性分类

作者:模板之家 2017-12-9 16:50 809人关注

为了让同学们有个直观的了解,到电商网截了一个图片,就是红圈所示的部分现在就为大家介绍这个小组件,在小程序中,该如何去写下图为本项目的图:wxml:view class=title商品属 ...

为了让同学们有个直观的了解,到电商网截了一个图片,就是红圈所示的部分现在就为大家介绍这个小组件,在小程序中,该如何去写下图为本项目的图:wxml:view class="title"商品属 ...

 
 
 

为了让同学们有个直观的了解,到电商网截了一个图片,就是红圈所示的部分

 

 

现在就为大家介绍这个小组件,在小程序中,该如何去写

下图为本项目的图:

 

 

wxml

[html] view plain copy
 
  1. <view class="title">商品属性值联动选择</view>  
  2. <!--options-->  
  3. <view class="commodity_attr_list">  
  4.   <!--每组属性-->  
  5.   <view class="attr_box" wx:for="{{attrValueList}}" wx:for-item="attrValueObj" wx:for-index="attrIndex">  
  6.     <!--属性名-->  
  7.     <view class="attr_name">{{attrValueObj.attrKey}}</view>  
  8.     <!--属性值-->  
  9.     <view class="attr_value_box">  
  10.       <!--每个属性值-->  
  11.       <view class="attr_value {{attrIndex==firstIndex || attrValueObj.attrValueStatus[valueIndex]?(value==attrValueObj.selectedValue?'attr_value_active':''):'attr_value_disabled'}}" bindtap="selectAttrValue" data-status="{{attrValueObj.attrValueStatus[valueIndex]}}"  
  12.       data-value="{{value}}" data-key="{{attrValueObj.attrKey}}" data-index="{{attrIndex}}" data-selectedvalue="{{attrValueObj.selectedValue}}" wx:for="{{attrValueObj.attrValues}}" wx:for-item="value" wx:for-index="valueIndex">{{value}}</view>  
  13.     </view>  
  14.   </view>  
  15. </view>  
  16. <!--button-->  
  17. <view class="weui-btn-area">  
  18.   <button class="weui-btn" type="primary" bindtap="submit">确定</button>  
  19. </view>  

 

 

wxss

[css] view plain copy
 
  1. .title {  
  2.   padding10rpx 20rpx;  
  3.   margin10rpx 0;  
  4.   border-left4rpx solid #ccc;  
  5. }  
  6.   
  7. /*全部属性的主盒子*/  
  8. .commodity_attr_list {  
  9.   background#fff;  
  10.   padding0 20rpx;  
  11.   font-size26rpx;  
  12.   overflowhidden;  
  13.   width100%;  
  14. }  
  15. /*每组属性的主盒子*/  
  16. .attr_box {  
  17.   width100%;  
  18.   overflowhidden;  
  19.   border-bottom1rpx solid #ececec;  
  20. }  
  21. /*属性名*/  
  22. .attr_name {  
  23.   width20%;  
  24.   floatleft;  
  25.   padding15rpx 0;  
  26. }  
  27. /*属性值*/  
  28. .attr_value_box {  
  29.   width80%;  
  30. 邀请

路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)