Modal.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div v-if="modalFlag">
  3. <div class="vehicle_servies_modal">
  4. <div class="modal_content">
  5. <div class="input">
  6. <p>稿件名称</p>
  7. <input type="text" v-model="name">
  8. </div>
  9. <div class="btn">
  10. <button @click="submit" style="margin:0">保存</button>
  11. <button @click="hideModal" style="margin:0">取消</button>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. modalFlag: {
  21. type: Boolean,
  22. default: false
  23. }
  24. },
  25. data() {
  26. return{
  27. name: '',
  28. }
  29. },
  30. methods: {
  31. submit: function() {
  32. this.$emit('submit', this.name)
  33. },
  34. hideModal: function() {
  35. this.$emit('hide_modal');
  36. }
  37. }
  38. }
  39. </script>
  40. <style scoped lang="less">
  41. .vehicle_servies_modal{
  42. position: fixed;
  43. left: 0;
  44. top: 0;
  45. height: 100vh;
  46. width: 100vw;
  47. background-color: rgba(127, 127, 127, 0.7);
  48. display: flex;
  49. justify-content: center;
  50. align-items: center;
  51. .modal_content{
  52. width: 600px;
  53. height: 300px;
  54. background-color: #fff;
  55. transform: translateY(-50px);
  56. .input{
  57. width: 280px;
  58. margin: 0 auto;
  59. margin-top: 80px;
  60. display: flex;
  61. height: 28px;
  62. p{
  63. width: 80px;
  64. height: 28px;
  65. line-height: 28px;
  66. }
  67. input{
  68. width: 200px;
  69. border: 1px solid #555;
  70. }
  71. }
  72. .btn{
  73. padding-left: 80px;
  74. margin: 0 auto;
  75. width: 200px;
  76. margin-top: 30px;
  77. display: flex;
  78. justify-content: space-between;
  79. button{
  80. margin: 0!;
  81. }
  82. }
  83. }
  84. }
  85. </style>