graceDialog.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="grace-dialog-shade" v-if="show" @tap.stop="closeDialogByShade" @touchmove.stop.prevent="stopFun" :style="{backgroundColor:background, zIndex:zIndex}">
  3. <view class="grace-dialog gdFadeIn" @tap.stop="stopFun" :style="{width:width, borderRadius:borderRadius}">
  4. <view class="grace-dialog-title" v-if="isTitle"
  5. :style="{fontSize:titleSize, color:titleColor, fontWeight:titleWeight?'bold':'', background:titleBg, lineHeight:titleHeight}">{{title}}</view>
  6. <view class="grace-dialog-content" @tap.stop="stopFun"><slot name="content"></slot></view>
  7. <view class="grace-dialog-close-btn" :style="{color:closeBtnColor, zIndex:zIndex+1}" v-if="isCloseBtn" @tap.stop="closeDialog"></view>
  8. <view v-if="isBtns"><slot name="btns"></slot></view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: "graceDialog",
  15. props: {
  16. show : {
  17. type : Boolean,
  18. default : false
  19. },
  20. width : {
  21. type : String,
  22. default : '580rpx'
  23. },
  24. isCloseBtn: {
  25. type : Boolean,
  26. default : true
  27. },
  28. closeBtnColor : {
  29. type : String,
  30. default : '#FF0036'
  31. },
  32. isTitle : {
  33. type : Boolean,
  34. default : true
  35. },
  36. title : {
  37. type : String,
  38. default : ''
  39. },
  40. titleBg : {
  41. type : String,
  42. default : ''
  43. },
  44. titleHeight : {
  45. type : String,
  46. default : '100rpx'
  47. },
  48. titleWeight : {
  49. type : Boolean,
  50. default : true
  51. },
  52. titleSize : {
  53. type : String,
  54. default : '28rpx'
  55. },
  56. titleColor : {
  57. type : String,
  58. default : '#333333'
  59. },
  60. isBtns : {
  61. type : Boolean,
  62. default : true
  63. },
  64. background:{
  65. type : String,
  66. default : 'rgba(0, 0, 0, 0.5)'
  67. },
  68. borderRadius : {
  69. type : String,
  70. default : '6rpx'
  71. },
  72. zIndex : {
  73. type : Number,
  74. default : 999
  75. },
  76. canCloseByShade:{
  77. type : Boolean,
  78. default : true
  79. }
  80. },
  81. data() {
  82. return {
  83. }
  84. },
  85. methods:{
  86. closeDialogByShade:function(){
  87. if(this.canCloseByShade){this.closeDialog();}
  88. },
  89. closeDialog : function(){
  90. this.$emit('closeDialog');
  91. },
  92. stopFun : function(){}
  93. }
  94. }
  95. </script>
  96. <style scoped>
  97. @keyframes gdFadeIn{ from { opacity: 0; } 100% { opacity: 1; }}
  98. .gdFadeIn {animation:gdFadeIn 200ms linear;}
  99. .grace-dialog-shade{position:fixed; width:100%; height:100%; left:0; top:0; bottom:0; z-index:9991; display:flex; justify-content:center; align-items:center;}
  100. .grace-dialog{width:580rpx; background:#FFFFFF; position:relative;}
  101. .grace-dialog-title{line-height:100rpx; font-size:30rpx; text-align:center;}
  102. .grace-dialog-content{}
  103. .grace-dialog-close-btn{position:absolute; z-index:9993; right:0px; top:0px; font-size:30rpx; width:80rpx; height:80rpx; line-height:80rpx; text-align:center; font-family:"grace-iconfont";}
  104. .grace-dialog-close-btn:before{content:"\e632";}
  105. </style>