对接api

This commit is contained in:
2022-05-09 10:03:33 +08:00
parent e7a130533d
commit 4c46c6e22d
16 changed files with 243 additions and 184 deletions
@@ -1,15 +1,16 @@
import { Image, Swiper, SwiperItem, View } from "@tarojs/components"
import { useMemo, useState } from "react"
import { useMemo, useRef, useState } from "react"
import styles from './index.module.scss'
type item = {title:string, img:string, url:string, id:number}
type params = {
list?: item[]
}
}
export default ({list = []}: params) => {
const [pageIndex, setPageIndex] = useState(1)
const pageRef = useRef<any>(null)
const pageCount = useMemo(() => {
return list.length
@@ -17,7 +18,9 @@ export default ({list = []}: params) => {
const swiperChange = (e) => {
setPageIndex(e.detail.current + 1)
pageRef.current.innerHTML = 2
}
return (
<View className={styles.swiper}>
@@ -30,7 +33,7 @@ export default ({list = []}: params) => {
</SwiperItem>
})}
</Swiper>
<View className={styles.page}>{pageIndex+'/'+pageCount}</View>
<View className={styles.page} ref={pageRef}>{pageIndex+'/'+pageCount}</View>
</View>
)
}
+2 -3
View File
@@ -11,6 +11,7 @@ import { useEffect, useMemo, useState } from 'react';
import useManualPullDownRefresh from '@/use/useManualPullDownRefresh';
import { goLink } from '@/common/common';
import useUserInfo from '@/use/useUserInfo';
type item = {title:string, img:string, url:string, id:number}
type params = {
@@ -48,9 +49,6 @@ export default (props:params) => {
const [showOrderCount, setShowOrderCount] = useState(false)
// const showCartmemo = useMemo(() => {
// return showCart
// },[showCart])
const html = `<h1>这里是详情</h1>
<div style="font-size:13px">你好啊啊</div>
@@ -105,6 +103,7 @@ export default (props:params) => {
})
const {user} = useUserInfo()
return (
<View className={styles.main}>