W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
票券組件可應用于各種優(yōu)惠券、紅包、票等可兌換利益的虛擬資產。
{
"defaultTitle": "Coupon",
"usingComponents":{
"coupon":"mini-ali-ui/es/coupon/index",
"button": "mini-ali-ui/es/button/index",
"am-checkbox": "mini-ali-ui/es/am-checkbox/index",
"stepper": "mini-ali-ui/es/stepper/index"
}
}
<view style="margin-top: 10px;"></view>
<view>
<coupon title="券標題1"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
</coupon>
</view>
<view>
<coupon title="券標題2"
subtitle="券副標題"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
</coupon>
</view>
<view>
<coupon title="券標題3"
subtitle="券副標題"
used="{{true}}"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
<view slot="date">有效期:2020.02.14-2020.02.29</view>
<view slot="detail" class="coupon_rule">
<text>1、詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
<text>2、詳細規(guī)則說明詳細規(guī)則說明規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
</view>
</coupon>
</view>
<view>
<coupon title="券標題4"
subtitle="券副標題"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
<view slot="category" class="categoryDemo">
<text class="price">50</text><text class="unit">元</text><text class="type">滿減券</text>
</view>
<button shape="capsule" slot="action" onTap="onButtonTap" type="ghost">立即使用</button>
<view slot="date">有效期:2020.02.14-2020.02.29</view>
<view slot="detail" class="coupon_rule">
<text>1、詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
<text>2、詳細規(guī)則說明詳細規(guī)則說明規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
</view>
</coupon>
</view>
<view>
<coupon title="券標題5"
subtitle="券副標題"
onCouponClick="onCouponClick"
extra="{{false}}"
thumb="{{thumb}}">
<button shape="capsule" slot="action" onTap="onButtonTap" type="ghost">立即使用</button>
<view slot="date">有效期:2020.02.14-2020.02.29</view>
<view slot="detail" class="coupon_rule">
<text>1、詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
<text>2、詳細規(guī)則說明詳細規(guī)則說明規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
</view>
</coupon>
</view>
<view>
<coupon title="券標題6"
subtitle="券副標題"
onCouponClick="onCouponClick"
thumb="{{thumb}}"
>
<button shape="capsule" slot="action" onTap="onButtonTap" type="ghost">立即使用</button>
</coupon>
</view>
<view>
<coupon title="券標題7"
subtitle="券副標題"
moreBtn="查看更多"
moreHide="{{false}}"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
<button shape="capsule" slot="action" onTap="onButtonTap" type="primary">立即使用</button>
<view slot="date">有效期:2020.02.14-2020.02.29</view>
<view slot="detail" class="coupon_rule">
<text>1、詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
<text>2、詳細規(guī)則說明詳細規(guī)則說明規(guī)則說明詳細規(guī)則說明詳細規(guī)則說明;</text>
</view>
</coupon>
</view>
<view>
<coupon title="券標題8"
subtitle="券副標題"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
<am-checkbox slot="action" onTap="onButtonTap" />
</coupon>
</view>
<view>
<coupon title="券標題9"
subtitle="券副標題"
onCouponClick="onCouponClick"
thumb="{{thumb}}">
<stepper
slot="action"
step="{{1}}"
showNumber
min="{{2}}"
/>
</coupon>
</view>
<view style="margin-top: 50px;"></view>
Page({
data: {
thumb: 'https://gw.alipayobjects.com/mdn/rms_ce4c6f/afts/img/A*b-kqQ4RZgsYAAAAAAAAAAABkARQnAQ',
},
onCouponClick(e) {
if (e.currentTarget.dataset.used) {
return false;
} else {
my.alert({
content: '可用票券,票券點擊事件',
});
}
},
onButtonTap() {
my.alert({
content: '膠囊按鈕點擊事件',
});
},
});
.container {
padding-bottom: 50px;
}
.coupon_rule text {
display: block;
margin-bottom: 8rpx;
}
/* 左側權益內容的樣式 slot="category" */
.categoryDemo {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
align-items: baseline;
align-self: flex-start;
}
.categoryDemo .price {
font-size: 60rpx;
color: #FF6010;
}
.categoryDemo .unit {
padding-left: 4rpx;
font-weight: bold;
font-size: 26rpx;
color: #FF6010;
}
.categoryDemo .type {
flex: 1 1 100%;
text-align: center;
font-size: 22rpx;
color: #999;
}
屬性 | 類型 | 默認值 | 描述 | 必填 | 最低版本 |
---|---|---|---|---|---|
thumb | String | - | Coupon 縮略圖地址。 | - | - |
title | String | - | Coupon 標題。 | true | - |
subTitle | String | - | Coupon 副標題。 | - | - |
onCouponClick | Function | - | Coupon 點擊時的事件回調。 | - | - |
extra | Boolean | true | 票券是否展示左側擴展信息。 | - | 1.0.6) |
moreBtn | String | 規(guī)則詳情 | 票券使用規(guī)則點擊展開顯示更多的點擊區(qū)域文案。 | - | 1.0.6 |
moreHide | Boolean | true | 是否展開票券使用規(guī)則的更多信息。 | - | 1.0.6 |
used | Boolean | false | 票券是否失效。 | - | 1.0.6 |
slot name | 描述 |
---|---|
action | 票券右側的插槽。 |
date | 票券到期時間的插槽。 |
detail | 票券規(guī)則詳情的插槽。 |
category | 票券左側票券類別的插槽。 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: