ithui-bullet-one.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * ITHUI®
  3. * ITHUI-Bullet 适用于升级&通知、任务说明、活动规则、置顶公告弹框,兼容小程序、APP、H5。
  4. * Copyright (c) 2023 ITHANG All rights reserved.
  5. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  6. * 复制使用请保留本段注释,感谢支持开源!
  7. *
  8. * 作者主页
  9. * https://ithang.cn/
  10. *
  11. * 开源地址
  12. * https://github.com/ithang-cn/ITHUI-Bullet
  13. * https://gitee.com/ithang-cn/ITHUI-Bullet
  14. *
  15. */
  16. <template>
  17. <view class="ithui-bullet">
  18. <u-popup @click="handleCloseOnClickOverlay" :show="value" :zIndex="zIndex" :overlayOpacity="opacity"
  19. :closeOnClickOverlay="closeOnClickOverlay" mode="center" bgColor="transparent">
  20. <view class="bullet-box" :style="{borderColor,backgroundColor:bgColor}">
  21. <view class="top">
  22. <view class="title" :style="{color: titleColor}">{{title}}</view>
  23. </view>
  24. <scroll-view :scroll-top="scrollTop" :scroll-y="true" class="scroll-Y" @scroll="scroll">
  25. <view class="content" :style="{color: color}">
  26. <rich-text :nodes="content"></rich-text>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <view class="bullet-close">
  31. <u-icon @click="handleClose" name="close-circle" color="#fff" size="34"></u-icon>
  32. </view>
  33. </u-popup>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: "ithui-bullet-two",
  39. props: {
  40. value: {
  41. type: Boolean,
  42. default: false
  43. },
  44. zIndex: {
  45. type: String | Number,
  46. default: 10086
  47. },
  48. opacity: {
  49. type: String | Number,
  50. default: 0.5
  51. },
  52. closeOnClickOverlay: {
  53. type: Boolean,
  54. default: false
  55. },
  56. title: {
  57. type: String,
  58. default: '标题'
  59. },
  60. color: {
  61. type: String,
  62. default: '#333'
  63. },
  64. titleColor: {
  65. type: String,
  66. default: '#7d4802'
  67. },
  68. borderColor: {
  69. type: String,
  70. default: '#fad489'
  71. },
  72. bgColor: {
  73. type: String,
  74. default: '#fffdf1'
  75. },
  76. content: {
  77. type: String,
  78. default: ''
  79. },
  80. },
  81. data() {
  82. return {
  83. scrollTop: 0,
  84. old: {
  85. scrollTop: 0
  86. }
  87. };
  88. },
  89. methods: {
  90. handleOK() {
  91. this.$emit('input', false);
  92. this.$emit('confirm');
  93. },
  94. handleCloseOnClickOverlay() {
  95. if (this.closeOnClickOverlay) {
  96. this.$emit('input', false);
  97. this.$emit('close');
  98. }
  99. },
  100. handleClose() {
  101. this.$emit('input', false);
  102. this.$emit('cancel');
  103. },
  104. scroll(e) {
  105. this.old.scrollTop = e.detail.scrollTop
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .ithui {
  112. &-bullet {
  113. .bullet {
  114. &-box {
  115. background-color: #fff;
  116. width: 620rpx;
  117. height: 60vh;
  118. border-radius: 20rpx;
  119. border-width: 10rpx;
  120. border-style: solid;
  121. .top {
  122. font-size: 38rpx;
  123. text-align: center;
  124. font-weight: bold;
  125. margin-top: 60rpx;
  126. }
  127. .scroll-Y {
  128. margin-top: 20rpx;
  129. height: 48vh;
  130. .content {
  131. margin: 0 30rpx;
  132. }
  133. }
  134. }
  135. &-close {
  136. margin-top: 20rpx;
  137. display: flex;
  138. justify-content: center;
  139. }
  140. }
  141. }
  142. }
  143. </style>