UI还原
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
import { ref, reactive, watch } from "vue";
|
||||
|
||||
import { donateAPI } from "@/apis";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { config } = storeToRefs(store);
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
@@ -13,7 +17,7 @@ const props = defineProps({
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const amounts = [5, 20, 50, 80, 100, 200];
|
||||
const amounts = ref([]);
|
||||
const selected = ref(null);
|
||||
const checked = ref(false);
|
||||
|
||||
@@ -27,7 +31,7 @@ const formData = reactive({
|
||||
const onPay = async (index) => {
|
||||
selected.value = index;
|
||||
const result = await donateAPI(
|
||||
0.01,
|
||||
amounts.value[index],
|
||||
formData.name,
|
||||
formData.account,
|
||||
formData.organization,
|
||||
@@ -60,6 +64,14 @@ const onPay = async (index) => {
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => config.value.donateAmount,
|
||||
(value) => {
|
||||
amounts.value = value || [];
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.show,
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user