This commit is contained in:
expdsn 2024-11-08 14:50:27 +08:00
parent 27b4623500
commit bbfd1284e9
2 changed files with 8 additions and 11 deletions

View File

@ -4,9 +4,10 @@ import { RiTimeLine } from 'oh-vue-icons/icons'
import { addIcons, OhVueIcon } from 'oh-vue-icons' import { addIcons, OhVueIcon } from 'oh-vue-icons'
import { IoCloseCircleOutline, RiCloseCircleLine } from 'oh-vue-icons/icons' import { IoCloseCircleOutline, RiCloseCircleLine } from 'oh-vue-icons/icons'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import useDiscountStore from './useDiscountStore'
addIcons(RiTimeLine, IoCloseCircleOutline, RiCloseCircleLine) addIcons(RiTimeLine, IoCloseCircleOutline, RiCloseCircleLine)
export default defineComponent(() => { export default defineComponent(() => {
const store = useGameNews() const store = useDiscountStore()
const containerRef = ref<VNodeRef | null>(null as VNodeRef | null) const containerRef = ref<VNodeRef | null>(null as VNodeRef | null)
const searchText = ref('') const searchText = ref('')
const handleScroll = () => { const handleScroll = () => {

View File

@ -23,18 +23,14 @@ export default defineStore("gameDiscount", () => {
const loading = ref(false) const loading = ref(false)
const noMoreData = ref(false) const noMoreData = ref(false)
const state = reactive({ const state = reactive({
pageId: 1, pageSize: 1,
name: '', pageIndex: 1,
find: ''
}) })
const getList = async () => { const getList = async () => {
const res = await request<{ const res = await request<{
data: GameDiscount[]; data: GameDiscount[];
}>('POST', '/api/gameDiscount', { }>('GET', `/api/gameDiscount?pageSize=${state.pageSize}&pageIndex=${state.pageIndex}&find=${state.find}`)
data: {
pageId: state.pageId,
name: state.name
}
})
return res.data return res.data
} }
const getNews = async () => { const getNews = async () => {
@ -47,7 +43,7 @@ export default defineStore("gameDiscount", () => {
noMoreData.value = true; noMoreData.value = true;
} else { } else {
list.value.push(...data); list.value.push(...data);
state.pageId += 1; state.pageIndex += 1;
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);