|
|
@@ -1,7 +1,7 @@
|
|
|
<!-- 表格搜索栏示例 -->
|
|
|
<template>
|
|
|
<div class="search-bar">
|
|
|
- <course-search ref="courseSearchRef" @search="getCourseData"></course-search>
|
|
|
+ <course-search ref="courseSearchRef" @search="(params) => getCourseData(params, false)" @reset="() => getCourseData({}, true)"></course-search>
|
|
|
<course-list :data="courseData" :loading="loading" :is-run="true">
|
|
|
<template #default="{ item }">
|
|
|
<div class="flex items-center">
|
|
|
@@ -32,15 +32,15 @@
|
|
|
const courseSearchRef = ref()
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- getCourseData()
|
|
|
+ getCourseData({}, true)
|
|
|
})
|
|
|
|
|
|
- const getCourseData = async (params: Record<string, unknown> = {}) => {
|
|
|
+ const getCourseData = async (params: Record<string, unknown> = {}, loadAll: boolean = false) => {
|
|
|
loading.value = true
|
|
|
if (Object.keys(params).length === 0) {
|
|
|
courseSearchRef?.value?.reset()
|
|
|
}
|
|
|
- const { data } = await CourseServer.list(params)
|
|
|
+ const { data } = await CourseServer.list(params, loadAll)
|
|
|
courseData.value = data!
|
|
|
loading.value = false
|
|
|
}
|