Open dingdingtop opened 4 years ago
您是说单个item吗,如果想自定义更多,建议使用popup
实现起来很简单,@BeiQiaoT:
<template>
<u-popup mode="bottom" :border-radius="borderRadius" :popup="false" v-model="value" :maskCloseAble="maskCloseAble" length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="popupClose" :z-index="uZIndex">
<view class="u-tips u-border-bottom" v-if="tips.text" :style="[tipsStyle]">{{tips.text}}</view>
<view v-if="list && list.length">
<block v-for="(item, index) in list" :key="index">
<view @touchmove.stop.prevent @tap="itemClick(index)" :style="[itemStyle(index)]" class="u-action-sheet-item" :class="[index < list.length - 1 ? 'u-border-bottom' : '']" hover-class="u-hover-class" :hover-stay-time="150">{{item.text}}</view>
</block>
</view>
<slot />
<view class="u-gab" v-if="cancelBtn"></view>
<view @touchmove.stop.prevent class="u-actionsheet-cancel u-action-sheet-item" hover-class="u-hover-class" :hover-stay-time="150" v-if="cancelBtn" @tap="close">取消</view>
</u-popup>
</template>
建议给ActionSheet组件添加slot,可以自定义Action内容和样式,参考vant-weapp的 action-sheet组件: https://github.com/youzan/vant-weapp/blob/dev/dist/action-sheet/index.wxml