heikaimu / vue3-waterfall-plugin

vue3 瀑布流插件,支持 PC 和移动端,支持 animate 的所有动画效果,支持图片懒加载
https://vue3-waterfall.netlify.app/
390 stars 29 forks source link

添加搜索功能 #34

Open didiplus opened 1 year ago

didiplus commented 1 year ago

第一次请求没有问题,再次加载就出现问题 搜索组件传递参数,后调用父组件的handleLoadMore

子组件

<script setup lang="ts"> import { ref ,defineEmits} from 'vue' const emits = defineEmits(['childEvent']) const keywork = ref("") const handleEnter = () =>{ emits('childEvent',keywork.value) } </script> 父组件 ` onMounted(() => { handleLoadMore("风景") })

// 加载更多 function handleLoadMore(keywork:string) {

toutiao_search_pic({ page: page.value, size: props.pageSize, term: keywork }).then((res) => { list.value.push(...res) page.value += props.pageSize }) } ` 请教一下,要实现这个功能如何做

heikaimu commented 11 months ago

我的example里面就是加载更多,你可以看看里面的代码