在所有相关的 Vue 组件中添加了 axios 导入,并将 handleSubmit 函数修改为异步函数,以便在提交表单时处理 API 请求并根据响应状态更新提交状态。
This commit is contained in:
parent
4933765a4c
commit
98cd9fbbe0
@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
|
||||
import axios from 'axios'
|
||||
const form = ref({
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
@ -11,9 +11,15 @@ const form = ref({
|
||||
});
|
||||
const submitted = ref(false);
|
||||
|
||||
function handleSubmit(e) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
submitted.value = true;
|
||||
const res = await axios.post('https://common.szjixun.cn/api/stock/submit/data', form.value)
|
||||
if(res.data.status === 0){
|
||||
submitted.value = true;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
|
||||
import axios from 'axios'
|
||||
const form = ref({
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
@ -11,9 +12,15 @@ alertType: "all"
|
||||
});
|
||||
const submitted = ref(false);
|
||||
|
||||
function handleSubmit(e) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
submitted.value = true;
|
||||
const res = await axios.post('https://common.szjixun.cn/api/stock/submit/data', form.value)
|
||||
if(res.data.status === 0){
|
||||
submitted.value = true;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import axios from 'axios'
|
||||
const form = ref({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
@ -11,9 +11,15 @@ const form = ref({
|
||||
});
|
||||
const submitted = ref(false);
|
||||
|
||||
function handleSubmit(e) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
submitted.value = true;
|
||||
const res = await axios.post('https://common.szjixun.cn/api/stock/submit/data', form.value)
|
||||
if(res.data.status === 0){
|
||||
submitted.value = true;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { NCarousel, NDivider, NMarquee, NPopselect } from "naive-ui";
|
||||
import { onUnmounted, ref, watch, onMounted, computed } from "vue";
|
||||
|
||||
import axios from 'axios'
|
||||
const form = ref({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
@ -12,9 +12,15 @@ const form = ref({
|
||||
});
|
||||
const submitted = ref(false);
|
||||
|
||||
function handleSubmit(e) {
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
submitted.value = true;
|
||||
const res = await axios.post('https://common.szjixun.cn/api/stock/submit/data', form.value)
|
||||
if(res.data.status === 0){
|
||||
submitted.value = true;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user