y-Dailog.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <!-- 首页资源珍贵弹窗 -->
  3. <view class="model-wrap" v-if="showModel" @tap="_hideModel">
  4. <view class="model-cont flex-center" @tap.stop>
  5. <view class="title padding-tb-lg" v-if="model.title">{{model.title}}</view>
  6. <view class="tip-text padding-tb-lg" v-if="model.content">{{model.content}}</view>
  7. <view class="btn-box">
  8. <view v-if="model.cancle" class="main-btn model-btn-two" @tap="_handleCancle">{{model.cancle}}</view>
  9. <view v-if="model.sure" class="main-btn model-btn model-btn-two" @tap="_handleSure">{{model.sure}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. showModel: false,
  19. model: {
  20. title: '',
  21. content: '',
  22. sure: '确定',
  23. cancle: '取消'
  24. },
  25. callBack: null
  26. }
  27. },
  28. methods: {
  29. _showModel(params) {
  30. this.showModel = true
  31. this.model = { ...params
  32. }
  33. this.$emit('showModel')
  34. },
  35. //隐藏弹窗
  36. _hideModel() {
  37. this.showModel = false
  38. },
  39. _handleSure() {
  40. this.showModel = false
  41. if (this.model.success) {
  42. this.model.success()
  43. }
  44. },
  45. _handleCancle() {
  46. this.showModel = false
  47. if (this.model.fail) {
  48. this.model.fail()
  49. }
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="less">
  55. .model-wrap {
  56. .model-cont {
  57. flex-direction: column;
  58. width: 100%;
  59. margin: 0 60rpx;
  60. padding: 60rpx 30rpx 40rpx;
  61. background-color: #FFFFFF;
  62. border-radius: 8px;
  63. .tip-img {
  64. width: 120rpx;
  65. height: 120rpx;
  66. }
  67. .title {
  68. font-size: 32rpx;
  69. color: #333333;
  70. font-family: 'aliM';
  71. text-align: center;
  72. max-width: 460upx;
  73. }
  74. .tip-text {
  75. max-width: 460upx;
  76. line-height: 40rpx;
  77. text-align: center;
  78. font-size: 28rpx;
  79. color: #666666;
  80. }
  81. .model-btn {
  82. width: 400rpx;
  83. height: 72rpx;
  84. text-align: center;
  85. }
  86. .model-btn-two {
  87. text-align: center;
  88. padding: 12upx 36upx;
  89. flex: 1;
  90. margin: 0 10upx;
  91. letter-spacing: -2upx;
  92. max-width: 400rpx;
  93. }
  94. .btn-box {
  95. width: 100%;
  96. display: flex;
  97. flex-direction: row;
  98. justify-content: center;
  99. .model-btn {
  100. flex: 1;
  101. width: 260rpx;
  102. height: 72rpx;
  103. background-color: var(--mainColor) !important;
  104. color: #FFFFFF !important;
  105. }
  106. }
  107. }
  108. }
  109. </style>