mask-tips.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <!-- 蒙层操作提示 -->
  3. <view class="mask-tips-container" v-if="show">
  4. <view class="content-box" :style="{top: top}">
  5. <image class="tip-img" src="@/static/imgs/fighter.gif"></image>
  6. <view class="tips-text">{{text}}</view>
  7. <u-button color="#fff" @click="show = false"
  8. :customStyle="{background: 'transparent', fontSize: '32rpx', height: '56rpx', borderRadius: '16rpx', width: '180rpx'}">我知道了</u-button>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. top: { // 文案内容到顶部位置
  16. type: String,
  17. default: '158rpx'
  18. },
  19. text: { // 文案内容
  20. type: String,
  21. default: '左滑删除商品'
  22. },
  23. tipId: { // 缓存id 必传
  24. type: String
  25. }
  26. },
  27. data() {
  28. return {
  29. show: false
  30. }
  31. },
  32. mounted() {
  33. if (!this.tipId) {
  34. return
  35. }
  36. const tipId = this.$getSS(`maskTip_${this.tipId}`)
  37. if (tipId) {
  38. this.show = false
  39. } else {
  40. this.show = true
  41. this.$setSS(`maskTip_${this.tipId}`, true)
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped lang="scss">
  47. .mask-tips-container {
  48. position: fixed;
  49. left: 0;
  50. top: 0;
  51. bottom: 0;
  52. right: 0;
  53. background-color: rgba(0, 0, 0, .35);
  54. z-index: 9999;
  55. .content-box {
  56. position: absolute;
  57. right: 0;
  58. top: 0;
  59. z-index: 10;
  60. text-align: center;
  61. width: 300rpx;
  62. .tips-text {
  63. font-size: 32rpx;
  64. color: #fff;
  65. font-weight: bold;
  66. margin: 14rpx 0;
  67. }
  68. .tip-img {
  69. width: 210rpx;
  70. height: 200rpx;
  71. margin: 0 auto;
  72. }
  73. }
  74. }
  75. </style>