import { PropType, defineComponent, onMounted, reactive, ref } from 'vue'; import styles from './index.module.less'; import { NButton, NInput, NSelect } from 'naive-ui'; import { useCatchStore } from '/src/store/modules/catchData'; import { useThrottleFn } from '@vueuse/core'; import { api_chapterLessonCoursewareTag_queryAll } from '/src/views/prepare-lessons/api'; export default defineComponent({ name: 'resource-search-group', emits: ['search'], setup(props, { emit }) { const catchStore = useCatchStore(); const forms = reactive({ keyword: '', chapterLessonCoursewareTagId: '' }); const tagList = ref([]); const onSearch = () => { emit('search', forms); }; const throttledFn = useThrottleFn(() => onSearch(), 500); const getTagAll = async () => { const { data } = await api_chapterLessonCoursewareTag_queryAll(); const result = data || []; tagList.value = [{ name: '全部', id: '' }, ...result]; }; getTagAll(); // onMounted(async () => {}); return () => ( <>
{ throttledFn(); }} /> { if (e.code === 'Enter') { throttledFn(); } }} onClear={() => { forms.keyword = ''; throttledFn(); }}> {{ prefix: () => ( throttledFn()}> ) }}
); } });