import { defineComponent, ref, watch, type VNodeRef } from 'vue' import useGameNews from './useGameNews' import { RiTimeLine } from 'oh-vue-icons/icons' import { addIcons, OhVueIcon } from 'oh-vue-icons' import dayjs from 'dayjs' addIcons(RiTimeLine) export default defineComponent(() => { const store = useGameNews() const containerRef = ref(null as VNodeRef | null) const handleScroll = () => { const container = containerRef.value console.log(container) if (container.scrollTop + container.clientHeight >= container.scrollHeight - 50) { console.log('到底了') store.getNews() } } return () => (
{store.list.map((item, index) => { return (
{ window.open(item.share_url) }} key={index} >
{item.title} {item.content}
{dayjs(item.create_time * 1000).format('YYYY-MM-DD')}
) })}
{store.loading && (
加载中...
)} {store.noMoreData && (
无更多数据
)}
) })