graceDialog.nvue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="grace-dialog-shade" v-if="show" @tap.stop="closeDialogByShade" @touchmove.stop.prevent="stopFun" :style="{backgroundColor:background}">
  3. <view class="grace-dialog gdFadeIn" @tap.stop="stopFun" :style="{width:width, borderRadius:borderRadius}">
  4. <text class="grace-dialog-title" v-if="isTitle"
  5. :style="{fontSize:titleSize, color:titleColor,fontWeight:titleWeight?'900':'',backgroundColor:titleBg, lineHeight:titleHeight}">{{title}}</text>
  6. <view @tap.stop="stopFun"><slot name="content"></slot></view>
  7. <text class="grace-dialog-close-btn grace-icons" :style="{color:closeBtnColor}" v-if="isCloseBtn" @tap.stop="closeDialog">&#xe632;</text>
  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. titleWeight : {
  41. type : Boolean,
  42. default : true
  43. },
  44. titleSize : {
  45. type : String,
  46. default : '28rpx'
  47. },
  48. titleColor : {
  49. type : String,
  50. default : '#333333'
  51. },
  52. isBtns : {
  53. type : Boolean,
  54. default : true
  55. },
  56. background:{
  57. type : String,
  58. default : 'rgba(0, 0, 0, 0.5)'
  59. },
  60. borderRadius : {
  61. type : String,
  62. default : '6rpx'
  63. },
  64. titleBg : {
  65. type : String,
  66. default : ''
  67. },
  68. titleHeight : {
  69. type : String,
  70. default : '100rpx'
  71. },
  72. canCloseByShade:{
  73. type : Boolean,
  74. default : true
  75. }
  76. },
  77. data() {
  78. return {
  79. }
  80. },
  81. methods:{
  82. closeDialogByShade:function(){
  83. if(this.canCloseByShade){this.closeDialog();}
  84. },
  85. closeDialog : function(){
  86. this.$emit('closeDialog');
  87. },
  88. stopFun : function(){}
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .grace-dialog-shade{position:fixed; width:750rpx; flex:1; left:0; top:0; bottom:0; justify-content:center; align-items:center;}
  94. .grace-dialog{width:580rpx; background-color:#FFFFFF;}
  95. .grace-dialog-title{line-height:100rpx; font-size:30rpx; text-align:center;}
  96. .grace-dialog-close-btn{position:absolute; right:0px; top:0px; font-size:30rpx; width:80rpx; height:80rpx; line-height:80rpx; text-align:center;}
  97. </style>