SubmitFormBtn.vue 672 B

12345678910111213141516171819202122232425262728293031
  1. <script setup lang="ts">
  2. const emits = defineEmits(['submitClick'])
  3. const buttonLoading = defineModel('buttonLoading', {type: Boolean, required: true} )
  4. const handleButtonClick = () => {
  5. // 设置loading状态
  6. buttonLoading.value = true;
  7. emits('submitClick', () => {
  8. // 操作完成后重置loading状态
  9. buttonLoading.value = false;
  10. });
  11. };
  12. </script>
  13. <template>
  14. <el-form-item>
  15. <el-button
  16. type="primary"
  17. class="bf-login-submit-btn"
  18. @click="handleButtonClick"
  19. :loading="buttonLoading"
  20. >
  21. <slot>
  22. 登陆
  23. </slot>
  24. </el-button>
  25. </el-form-item>
  26. </template>
  27. <style scoped lang="scss">
  28. </style>