uView icon indicating copy to clipboard operation
uView copied to clipboard

建议给ActionSheet组件添加slot,可以自定义Action内容和样式

Open dingdingtop opened this issue 6 years ago • 2 comments

建议给ActionSheet组件添加slot,可以自定义Action内容和样式,参考vant-weapp的 action-sheet组件: https://github.com/youzan/vant-weapp/blob/dev/dist/action-sheet/index.wxml

dingdingtop avatar May 21 '20 01:05 dingdingtop

您是说单个item吗,如果想自定义更多,建议使用popup

BeiQiaoT avatar May 22 '20 06:05 BeiQiaoT

实现起来很简单,@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>

dingdingtop avatar May 25 '20 06:05 dingdingtop