Tips.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <transition
  3. appear
  4. name="custom-classes-transition"
  5. enter-active-class="animated fadeIn faster"
  6. leave-active-class="animated fadeOut faster"
  7. >
  8. <popup v-if="show" :is-pass="true">
  9. <div class="ui-message-tips" :style="{fontSize:fontSize}" v-html="content"></div>
  10. </popup>
  11. </transition>
  12. </template>
  13. <script>
  14. import Popup from '../popup'
  15. export default {
  16. name: 'ui-tips',
  17. components: {
  18. Popup
  19. },
  20. data () {
  21. return {
  22. show: false,
  23. duration: 2000,
  24. content: '',
  25. fontSize: ''
  26. }
  27. },
  28. mounted () {
  29. setTimeout(() => {
  30. this.show = false
  31. this.$nextTick(function () {
  32. document.body.removeChild(this.$el)
  33. this.$destroy(true)
  34. })
  35. }, this.duration)
  36. }
  37. }
  38. </script>
  39. <style lang="less" scoped>
  40. .ui-message-tips {
  41. position: absolute;
  42. left: 50%;
  43. top: 50%;
  44. color: #fff;
  45. background-color: rgba(0, 0, 0, 0.5);
  46. padding: 20px;
  47. transform: translate(-50%, -50%);
  48. border-radius: 10px;
  49. box-shadow: 0 0px 35px rgba(0, 0, 0, 0.3);
  50. }
  51. [show-mode="mobile"],
  52. [edit-mode="mobile"] {
  53. .ui-message-tips {
  54. top: 40%;
  55. padding: 25px 10px;
  56. width: 60%;
  57. text-align: center;
  58. line-height: 1.8;
  59. }
  60. }
  61. </style>