114 lines
2.2 KiB
Vue
114 lines
2.2 KiB
Vue
|
<template>
|
|||
|
<view class="collection-item">
|
|||
|
<u-swipe-action
|
|||
|
v-for="(item, index) in list" :key="index"
|
|||
|
:index='index'
|
|||
|
:show="item.show"
|
|||
|
:options="options"
|
|||
|
@click="click"
|
|||
|
@open="open"
|
|||
|
>
|
|||
|
<view class="item u-border-bottom">
|
|||
|
<image src="@/pageE/static/mine/23.png"></image>
|
|||
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
|||
|
<view class="title-wrap">
|
|||
|
<view class="item-top u-line-2">木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子</view>
|
|||
|
<view class="item-bottom">
|
|||
|
<view class="item-price">¥99</view>
|
|||
|
<view class="item-date">
|
|||
|
<image src="@/pageE/static/mine/26.png"></image>
|
|||
|
<view>2020-05-17</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</u-swipe-action>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
list: [
|
|||
|
{
|
|||
|
id: 1,
|
|||
|
show: false
|
|||
|
},
|
|||
|
{
|
|||
|
id: 2,
|
|||
|
show: false
|
|||
|
},
|
|||
|
{
|
|||
|
id: 3,
|
|||
|
show: false,
|
|||
|
}
|
|||
|
],
|
|||
|
btnWidth: 152,
|
|||
|
show: false,
|
|||
|
options: [
|
|||
|
{
|
|||
|
text: '删除',
|
|||
|
style: {
|
|||
|
backgroundColor: '#FF3131'
|
|||
|
}
|
|||
|
}
|
|||
|
]
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
click(index) {
|
|||
|
this.list.splice(index, 1);
|
|||
|
this.$u.toast(`删除了第${index+1}个cell`);
|
|||
|
},
|
|||
|
open(index) {
|
|||
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
|||
|
// 原本为'false',再次设置为'false'会无效
|
|||
|
this.list[index].show = true;
|
|||
|
this.list.map((val, idx) => {
|
|||
|
if(index != idx) this.list[idx].show = false;
|
|||
|
})
|
|||
|
}
|
|||
|
},
|
|||
|
};
|
|||
|
</script>
|
|||
|
<style lang="scss" scoped>
|
|||
|
.collection-item {
|
|||
|
.item {
|
|||
|
padding: 30rpx;
|
|||
|
display: flex;
|
|||
|
> image {
|
|||
|
width: 180rpx;
|
|||
|
height: 160rpx;
|
|||
|
border-radius: 10rpx;
|
|||
|
margin-right: 30rpx;
|
|||
|
flex-shrink: 0;
|
|||
|
}
|
|||
|
.title-wrap {
|
|||
|
.item-top {
|
|||
|
font-size: 30rpx;
|
|||
|
color: rgba(51,51,51,1);
|
|||
|
line-height: 44rpx;
|
|||
|
margin-bottom: 54rpx;
|
|||
|
}
|
|||
|
.item-bottom {
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
justify-content: space-between;
|
|||
|
.item-price {
|
|||
|
font-size: 30rpx;
|
|||
|
color: rgba(51,51,51,1);
|
|||
|
}
|
|||
|
.item-date {
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
> image {
|
|||
|
margin-right: 25rpx;
|
|||
|
width: 24rpx;
|
|||
|
height: 24rpx;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</style>
|