feat:合并

This commit is contained in:
lixg
2022-12-13 18:30:41 +08:00

View File

@@ -2,6 +2,7 @@ import router from "@/router";
import {reactive, ref, toRefs, watch} from "vue";
import axios from 'axios';
import {getCookie} from "@/api/utils";
import {BASE} from "@/api/api";
export function usePage(_url, param) {
@@ -22,7 +23,7 @@ export function usePage(_url, param) {
function fetchData() {
state.loading = true
request(_url, state.params).then(r => {
state.params.pageNo === 1 ? (state.data = (r.data.records||r.data.rows)) : (state.data = [...state.data, ...(r.data.records||r.data.rows)])
state.params.pageNo === 1 ? (state.data = (r.data.records || r.data.rows)) : (state.data = [...state.data, ...(r.data.records || r.data.rows)])
state.size = r.data.size
state.total = r.data.total
state.current = r.data.current
@@ -82,7 +83,7 @@ export async function request(_url, params) {
}
const body = method !== 'get' ? params || {} : {}
return axios({
url,
url: BASE + url,
method,
headers: {
'X-Token': localStorage.getItem('token'),