welcome-tip.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="cu-bar bg-white zaiui-welcome-tip" :class="Show?'show':''">
  3. <view class="text-center text-black text-lg">
  4. <text class="cuIcon-emoji"></text>
  5. <text class="margin-left-xs">{{Content}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'welcome-tip',
  12. data() {
  13. return {
  14. Content: "", Show: false, C_s: 5000,
  15. };
  16. },
  17. props: {
  18. content: {
  19. type: String,
  20. default: ""
  21. },
  22. show: {
  23. type: Boolean,
  24. default: false
  25. },
  26. c_s: {
  27. type: Number,
  28. default: 5000
  29. }
  30. },
  31. created() {
  32. this.Content = this.content;
  33. this.Show = this.show;
  34. this.C_s = this.c_s;
  35. this.iniTime();
  36. },
  37. watch: {
  38. content() {
  39. this.Content = this.content;
  40. if(!this.content) {
  41. this.Show = false;
  42. }
  43. this.iniTime();
  44. },
  45. show() {
  46. this.Show = this.show;
  47. this.iniTime();
  48. },
  49. c_s() {
  50. this.C_s = this.c_s;
  51. this.iniTime();
  52. }
  53. },
  54. methods: {
  55. iniTime() {
  56. if(this.Show && this.C_s > 0) {
  57. setTimeout(() => {
  58. this.Show = false;
  59. this.CloseEvent();
  60. }, this.C_s);
  61. }
  62. },
  63. CloseEvent() {
  64. this.$emit('closeFinish', this.Show);
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .zaiui-welcome-tip {
  71. position: relative;
  72. width: 100%;
  73. z-index: 9;
  74. padding-top: var(--status-bar-height);
  75. top: calc((var(--status-bar-height) + 101upx) - (var(--status-bar-height) + 101upx) - (var(--status-bar-height) + 101upx));
  76. min-height: calc(var(--status-bar-height) + 101upx);
  77. transition: top .25s;
  78. .text-center {
  79. position: relative;
  80. width: 100%;
  81. }
  82. }
  83. .zaiui-welcome-tip.show {
  84. top: 0;
  85. min-height: calc(var(--status-bar-height) + 101upx);
  86. transition: top .25s;
  87. }
  88. </style>