addPopup.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <popup class="add-popup" round v-model:show="showAddPopup" :close-on-click-overlay="false">
  3. <div class="popup-title">添加分组</div>
  4. <el-input class="popup-input" v-model="input" placeholder="分组名" size="large" />
  5. <div class="popup-button">
  6. <div class="cancel" @click="showAddPopup = false">取消</div>
  7. <div class="confirm" @click="handleConfirm">确定</div>
  8. </div>
  9. </popup>
  10. </template>
  11. <script setup>
  12. import { ref, watch } from "vue";
  13. import { Popup} from "vant";
  14. const props = defineProps({
  15. show:{
  16. type:Boolean,
  17. defalut:false
  18. }
  19. })
  20. const input = ref("");
  21. const showAddPopup = ref(false)
  22. watch(()=>props.show,()=>{
  23. input.value = ""
  24. showAddPopup.value = true
  25. })
  26. const emit = defineEmits(["confirm"]);
  27. const handleConfirm = () => {
  28. showAddPopup.value = false;
  29. emit("confirm", input.value);
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .add-popup{
  34. width: 90%;
  35. padding: 20px 16px;
  36. .popup-title{
  37. font-size: 18px;
  38. font-weight: 500;
  39. text-align: center;
  40. margin-bottom: 12px;
  41. }
  42. .popup-input{
  43. margin-bottom: 30px;
  44. }
  45. .popup-button{
  46. display: flex;
  47. padding-top: 20px;
  48. border-top: 1px solid rgba(0, 0, 0, 0.1);
  49. div{
  50. flex: 1;
  51. font-size: 16px;
  52. padding: 9px;
  53. border-radius: 20px;
  54. background: #2199F8;
  55. color: #fff;
  56. text-align: center;
  57. }
  58. .cancel{
  59. margin-right: 20px;
  60. color: #000;
  61. background: #fff;
  62. border: 1px solid #999999;
  63. }
  64. }
  65. }
  66. </style>