修改详情弹出
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useCallback, forwardRef, useImperativeHandle, useEffect } from 'react'
|
import React, { useState, useCallback, forwardRef, useImperativeHandle } from 'react'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
import { View, Text, Image, ScrollView } from '@tarojs/components'
|
import { View, Text, Image, ScrollView } from '@tarojs/components'
|
||||||
import images from '@/config/images'
|
import images from '@/config/images'
|
||||||
@@ -70,6 +70,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
onAnyInput
|
onAnyInput
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const [openPicker, setOpenPicker] = useState(false);
|
const [openPicker, setOpenPicker] = useState(false);
|
||||||
|
const [scrollTop, setScrollTop] = useState(0);
|
||||||
const { getDictionaryValue } = useDictionaryActions()
|
const { getDictionaryValue } = useDictionaryActions()
|
||||||
const court_type = getDictionaryValue('court_type') || []
|
const court_type = getDictionaryValue('court_type') || []
|
||||||
const court_surface = getDictionaryValue('court_surface') || []
|
const court_surface = getDictionaryValue('court_surface') || []
|
||||||
@@ -170,14 +171,27 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const changeTextarea = (value) => {
|
||||||
|
if (value) {
|
||||||
|
// 先滚动到底部
|
||||||
|
setScrollTop(scrollTop ? scrollTop + 1 : 9999);
|
||||||
|
// 使用 setTimeout 确保滚动后再更新 openPicker
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const changePicker = (value) => {
|
const changePicker = (value) => {
|
||||||
setOpenPicker(value)
|
setOpenPicker(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(stadium,'stadiumstadium');
|
console.log(stadium,'stadiumstadium');
|
||||||
return (
|
return (
|
||||||
<View className='stadium-detail'>
|
<View className='stadium-detail'>
|
||||||
<ScrollView className='stadium-detail-scroll' refresherBackground="#FAFAFA" scrollY={!openPicker}>
|
<ScrollView
|
||||||
|
className='stadium-detail-scroll'
|
||||||
|
refresherBackground="#FAFAFA"
|
||||||
|
scrollY={!openPicker}
|
||||||
|
scrollTop={scrollTop}
|
||||||
|
>
|
||||||
{/* 已选球场 */}
|
{/* 已选球场 */}
|
||||||
<View
|
<View
|
||||||
className={`stadium-item`}
|
className={`stadium-item`}
|
||||||
@@ -220,9 +234,12 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
<View className='textarea-tag-container'>
|
<View className='textarea-tag-container'>
|
||||||
<TextareaTag
|
<TextareaTag
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
onChange={(value) => updateFormData(item.prop, value)}
|
onChange={(value) => {
|
||||||
onBlur={() => changePicker(false)}
|
changeTextarea(true)
|
||||||
onFocus={() => changePicker(true)}
|
updateFormData(item.prop, value)
|
||||||
|
}}
|
||||||
|
// onBlur={() => changeTextarea(false)}
|
||||||
|
onFocus={() => changeTextarea(true)}
|
||||||
placeholder='有其他场地信息可备注'
|
placeholder='有其他场地信息可备注'
|
||||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user