gui-modal.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <gui-popup
  3. ref="guipopupformodal"
  4. :width="width"
  5. height="460px"
  6. :canCloseByShade="canCloseByShade"
  7. :zIndex="zIndex"
  8. @close="eClose">
  9. <view
  10. :class="customClass"
  11. class="gui-relative"
  12. @tap.stop.prevent="stopfun">
  13. <view>
  14. <text
  15. class="gui-block gui-text-center gui-primary-text"
  16. :style="titleStyle"
  17. v-if="title != ''">{{title}}</text>
  18. </view>
  19. <view>
  20. <slot name="content"></slot>
  21. </view>
  22. <view>
  23. <slot name="btns"></slot>
  24. </view>
  25. <text
  26. class="gui-popup-close gui-block gui-absolute-rt gui-icons gui-color-gray"
  27. :style="'width:76rpx; height:76rpx; line-height:76rpx; text-align:center;'+closeBtnStyle"
  28. @tap.stop.prevent="close"
  29. v-if="isCloseBtn">&#xe7a5;</text>
  30. </view>
  31. </gui-popup>
  32. </template>
  33. <script>
  34. export default{
  35. name : "gui-modal",
  36. props : {
  37. width : { type : String, default : '580rpx'},
  38. isCloseBtn : { type : Boolean, default : true },
  39. closeBtnStyle : { type : String, default : 'font-size:28rpx;' },
  40. title : { type : String, default : '' },
  41. titleStyle : { type : String, default : 'line-height:100rpx; font-size:28rpx; font-weight:700;'},
  42. canCloseByShade : { type : Boolean, default : true },
  43. zIndex : { type : Number, default : 99 },
  44. customClass : { type : Array, default : function(){return ['gui-bg-white', 'gui-dark-bg-level-3'];}}
  45. },
  46. methods:{
  47. open : function(){
  48. this.$refs.guipopupformodal.open();
  49. this.$emit('open');
  50. },
  51. close : function(){
  52. this.$refs.guipopupformodal.close();
  53. this.$emit('close');
  54. },
  55. stopfun : function(e){
  56. e.stopPropagation();
  57. return null;
  58. },
  59. eClose : function(){
  60. this.$emit('close');
  61. }
  62. },
  63. emits : ['open', 'close']
  64. }
  65. </script>
  66. <style scoped>
  67. </style>