mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-07 18:06:48 +08:00
feat:合并
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user