popOutBox.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div v-if="showBox">
  3. <div @click="handleClick" class="mask">
  4. </div>
  5. <div class="box-container">
  6. <h1 class="title">
  7. <slot name="title"></slot>
  8. </h1>
  9. <div class="action-container">
  10. <button class="action-button">
  11. <slot name="action1"></slot>
  12. </button>
  13. <button class="action-button">
  14. <slot name="action2"></slot>
  15. </button>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: "popOutBox",
  23. props:['value'],
  24. data(){
  25. return{
  26. showBox:false
  27. }
  28. },
  29. methods:{
  30. handleClick(){
  31. this.showBox=false;
  32. this.$emit('input',false)
  33. }
  34. },
  35. watch:{
  36. value(val){
  37. this.showBox=!!val;
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. .mask{
  44. position: absolute;
  45. top: 0;
  46. left: 0;
  47. height: 100%;
  48. width: 100%;
  49. background-color: #000;
  50. opacity: 0.5;
  51. z-index: 999;
  52. }
  53. .box-container{
  54. position: absolute;
  55. width: 8.3rem;
  56. height: 4.2rem;
  57. border-radius: 0.1rem;
  58. background-color: white;
  59. left: 50%;
  60. top: 50%;
  61. transform: translate(-50%,-50%);
  62. z-index: 1000;
  63. }
  64. .title{
  65. margin-top: 1rem;
  66. font-size: 0.4rem;
  67. color: #1491e2;
  68. }
  69. .action-button{
  70. width: 3.8rem;
  71. height: 1.1rem;
  72. background-color: #60c0ff;
  73. border-radius: 0.6rem;
  74. color:#fff;
  75. border: none;
  76. margin-left: 0.15rem;
  77. margin-top: 0.9rem;
  78. font-size: 0.4rem;
  79. }
  80. </style>