|
|
@@ -16,17 +16,34 @@
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { getCourseList } from '@/api/course.js'
|
|
|
-import { ref, onMounted } from 'vue'
|
|
|
+import { ref, onMounted, watch, reactive } from 'vue'
|
|
|
+
|
|
|
+const props =defineProps({
|
|
|
+ info: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({})
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
const list = ref([]);
|
|
|
-onMounted(() => {
|
|
|
- getList();
|
|
|
-});
|
|
|
+const searchFom = reactive({
|
|
|
+ skillTag: '',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 5,
|
|
|
+})
|
|
|
+
|
|
|
+watch(() => props.info.skillTag, (newVal, oldVal) => {
|
|
|
+ if(newVal !== oldVal){
|
|
|
+ // 课程ID变化时,重置分页参数
|
|
|
+ searchFom.skillTag = newVal
|
|
|
+ getList('init');
|
|
|
+ }
|
|
|
+})
|
|
|
+// onMounted(() => {
|
|
|
+// getList();
|
|
|
+// });
|
|
|
const getList = async (type) => {
|
|
|
- const res = await getCourseList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 5,
|
|
|
- })
|
|
|
+ const res = await getCourseList(searchFom)
|
|
|
if(res.code === 200){
|
|
|
list.value = res.rows || [];
|
|
|
}
|