gui-action-sheet.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <gui-popup ref="guipopupforacsheet"
  3. position="bottom" :canCloseByShade="canCloseByShade">
  4. <view
  5. :style="{'margin-bottom':'25rpx','margin-left':((750-width)/2)+'rpx'}"
  6. @tap.stop.prevent="stopfun">
  7. <view class="gui-bg-white"
  8. :style="{width:width+'rpx', height:(height+100)+'rpx', borderRadius:borderRadius}">
  9. <text class="gui-action-sheet-title gui-block-text gui-border-b"
  10. :style="{color:titleColor}">{{title}}</text>
  11. <scroll-view scroll-y="true" class="gui-border-box"
  12. :style="{width:width+'rpx', height:height+'rpx', paddingTop:'20rpx', paddingBottom:'20rpx'}">
  13. <text class="gui-text-center gui-block-text gui-border-b"
  14. v-for="(item, index) in items" :key="index"
  15. @tap.stop="selected" :data-index="index"
  16. :style="{ color:listColor, lineHeight:listLineHeight, fontSize:listFontSize}">{{item}}</text>
  17. <text class="gui-text-center gui-block-text"
  18. :style="{color:cancelBtnColor, lineHeight:listLineHeight, fontSize:listFontSize, marginTop:'10rpx'}"
  19. v-if="isCancelBtn" @tap.stop="cancel">{{cancelBtnName}}</text>
  20. </scroll-view>
  21. </view>
  22. <!-- iphone 底部操作按钮躲避 -->
  23. <gui-iphone-bottom></gui-iphone-bottom>
  24. </view>
  25. </gui-popup>
  26. </template>
  27. <script>
  28. export default{
  29. name : "gui-action-sheet",
  30. props : {
  31. width : { type : Number, default : 680},
  32. height : { type : Number, default : 500},
  33. borderRadius : { type : String, default : '10rpx'},
  34. title : { type : String, default : ''},
  35. titleColor : { type : String, default : '#2B2E3D'},
  36. items : { type : Array, default : function(){return [];}},
  37. listColor : { type : String, default : '#008AFF'},
  38. listLineHeight : { type : String, default : '95rpx'},
  39. listFontSize : { type : String, default : '28rpx'},
  40. isCancelBtn : { type : Boolean, default : true},
  41. cancelBtnName : { type : String, default : '取消'},
  42. cancelBtnColor : { type : String, default : 'rgba(69, 90, 100, 0.6)'},
  43. canCloseByShade : { type : Boolean, default : false}
  44. },
  45. methods:{
  46. open : function(){
  47. this.$refs.guipopupforacsheet.open();
  48. },
  49. close : function(){
  50. this.$refs.guipopupforacsheet.close();
  51. },
  52. stopfun : function(e){
  53. e.stopPropagation();
  54. return null;
  55. },
  56. cancel : function () {
  57. this.$emit('cancel');
  58. this.close();
  59. },
  60. selected:function (e) {
  61. this.$emit('selected', e.currentTarget.dataset.index);
  62. this.close();
  63. },
  64. }
  65. }
  66. </script>
  67. <style scoped>
  68. .gui-action-sheet-title{text-align:center; font-size:26rpx; line-height:100rpx; height:100rpx; font-weight:bold;}
  69. </style>