QueryUnpublishedView.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div style="display: flex; justify-content: space-between">
  3. <a-form :model="formState">
  4. <a-form-item>
  5. <a-input v-model:value="formState.name" placeholder="请输入资源名称" style="width: 200px; margin-right: 20px" />
  6. <a-button type="primary" @click="onSubmit" :loading="iconLoading">
  7. <template #icon> <SearchOutlined /> </template>
  8. 提交
  9. </a-button>
  10. <a-button style="margin-left: 10px" @click="reset">
  11. <template #icon>
  12. <RedoOutlined />
  13. </template>
  14. 重置
  15. </a-button>
  16. </a-form-item>
  17. </a-form>
  18. <a-button type="primary" style="margin-left: 10px" @click="reset">
  19. <template #icon> <PlusOutlined /> </template>
  20. 上传资源
  21. </a-button>
  22. </div>
  23. </template>
  24. <script setup>
  25. import { ref } from 'vue'
  26. import { Form } from 'ant-design-vue'
  27. const emit = defineEmits(['selectTab'])
  28. const iconLoading = ref(false)
  29. const useForm = Form.useForm
  30. const formState = reactive({
  31. name: ''
  32. })
  33. const rulesRef = reactive({})
  34. const { resetFields, validate, validateInfos } = useForm(formState, rulesRef)
  35. const onSubmit = () => {
  36. iconLoading.value = true
  37. validate()
  38. .then(() => {
  39. iconLoading.value = false
  40. console.log(toRaw(formState))
  41. })
  42. .catch((err) => {
  43. console.log('error', err)
  44. iconLoading.value = false
  45. })
  46. }
  47. const reset = () => {
  48. resetFields()
  49. }
  50. </script>
  51. <style scoped>
  52. .tab-switcher {
  53. display: flex;
  54. border-radius: 20px;
  55. border: 1px solid #1e90ff;
  56. overflow: hidden;
  57. }
  58. .tab-switcher div {
  59. padding: 2px 20px;
  60. background-color: #f5f5f5;
  61. cursor: pointer;
  62. }
  63. .tab-switcher div.active {
  64. background-color: #1e90ff;
  65. color: white;
  66. }
  67. .tab-switcher div:not(:last-child) {
  68. }
  69. </style>