
import { useEffect, useState, useRef } from 'react';
import Taro from '@tarojs/taro'

export default function useScrollTop() {
  // 设置一个初始高度
  const [scrollTop, setScrollTop] = useState(1000)

  const scroll = () => {
    // Taro.createSelectorQuery()
    //     .select(selector)
    //     .boundingClientRect((rect) => {
    //       console.log('-------rect------->', rect)
    //   }).exec();
    Taro.nextTick(() => {
      setScrollTop(scrollTop + 500)
    })
  }

  return [scrollTop, scroll]
}
