通过微信开发者工具 商城模板 创建新小程序
This commit is contained in:
72
mini-program/pages/cart/components/specs-popup/index.js
Normal file
72
mini-program/pages/cart/components/specs-popup/index.js
Normal file
@@ -0,0 +1,72 @@
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true, // 在组件定义时的选项中启用多slot支持
|
||||
},
|
||||
|
||||
properties: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
observer(newVal) {
|
||||
this.setData({ 'goods.title': newVal });
|
||||
},
|
||||
},
|
||||
price: {
|
||||
type: String,
|
||||
value: '',
|
||||
observer(newVal) {
|
||||
this.setData({ 'goods.price': newVal });
|
||||
},
|
||||
},
|
||||
thumb: {
|
||||
type: String,
|
||||
value: '',
|
||||
observer(newVal) {
|
||||
this.setData({ 'goods.thumb': newVal });
|
||||
},
|
||||
},
|
||||
thumbMode: {
|
||||
type: String,
|
||||
value: 'aspectFit',
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 99,
|
||||
},
|
||||
specs: {
|
||||
type: Array,
|
||||
value: [],
|
||||
},
|
||||
},
|
||||
|
||||
data: {
|
||||
goods: {
|
||||
title: '',
|
||||
thumb: '',
|
||||
price: '',
|
||||
hideKey: {
|
||||
originPrice: true,
|
||||
tags: true,
|
||||
specs: true,
|
||||
num: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClose() {
|
||||
this.triggerEvent('close');
|
||||
},
|
||||
|
||||
onCloseOver() {
|
||||
this.triggerEvent('closeover');
|
||||
},
|
||||
},
|
||||
});
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-popup": "tdesign-miniprogram/popup/popup",
|
||||
"goods-card": "../../components/goods-card/index"
|
||||
}
|
||||
}
|
26
mini-program/pages/cart/components/specs-popup/index.wxml
Normal file
26
mini-program/pages/cart/components/specs-popup/index.wxml
Normal file
@@ -0,0 +1,26 @@
|
||||
<t-popup
|
||||
close-on-overlay-click="{{true}}"
|
||||
visible="{{show}}"
|
||||
placement="bottom"
|
||||
z-index="{{zIndex}}"
|
||||
>
|
||||
<view class="specs-popup">
|
||||
<view>
|
||||
<goods-card data="{{goods}}" layout="horizontal-wrap" thumb-mode="{{thumbMode}}" />
|
||||
<view class="section">
|
||||
<view class="title">已选规格</view>
|
||||
<view class="options">
|
||||
<view
|
||||
wx:for="{{specs}}"
|
||||
wx:for-item="spec"
|
||||
wx:key="spec"
|
||||
class="option"
|
||||
>{{spec}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-btn" hover-class="bottom-btn--active" bindtap="onClose">我知道了</view>
|
||||
</view>
|
||||
</t-popup>
|
||||
|
68
mini-program/pages/cart/components/specs-popup/index.wxss
Normal file
68
mini-program/pages/cart/components/specs-popup/index.wxss
Normal file
@@ -0,0 +1,68 @@
|
||||
.specs-popup {
|
||||
width: 100vw;
|
||||
box-sizing: border-box;
|
||||
padding: 32rpx 32rpx calc(20rpx + env(safe-area-inset-bottom)) 32rpx;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: white;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
.specs-popup .section {
|
||||
margin-top: 44rpx;
|
||||
flex: auto;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.specs-popup .section .title {
|
||||
font-size: 26rpx;
|
||||
color: #4f5356;
|
||||
}
|
||||
.specs-popup .section .options {
|
||||
color: #333333;
|
||||
font-size: 24rpx;
|
||||
margin-right: -26rpx;
|
||||
}
|
||||
.specs-popup .section .options .option {
|
||||
display: inline-block;
|
||||
margin-top: 24rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: #f5f5f5;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.specs-popup .section .options .option:not(:last-child) {
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
.specs-popup .bottom-btn {
|
||||
margin-top: 42rpx;
|
||||
position: relative;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
color: #fa4126;
|
||||
}
|
||||
.specs-popup .bottom-btn--active {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.specs-popup .bottom-btn::after {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
border: 1px solid #fa4126;
|
||||
border-radius: 80rpx;
|
||||
transform: scale(0.5);
|
||||
transform-origin: left top;
|
||||
}
|
Reference in New Issue
Block a user