jd-opensource / jd-opensource/taro-ui
taro 3.0.8 "taro-ui": "^3.0.0-alpha.3" 微信小程序 AtIndexes 组件点击索引列表有时无法跳转到指定索引
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
跟官方代码一模一样
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtIndexes, AtSearchBar } from 'taro-ui'
import mockData, { CityItem } from './mock-data'
import './index.scss'
interface IndexesState {
value: string
}
export default class Index extends Taro.Component<{}, IndexesState> {
public config: Taro.PageConfig = {
navigationBarTitleText: 'Taro UI'
}
public constructor () {
super(...arguments)
this.state = {
value: ''
}
}
public componentDidMount (): void {
console.log(this.scrollIntoView)
// this.scrollIntoView && this.scrollIntoView('top', 0)
}
private scrollIntoView (key: string): void {
console.log('不需要实际实现', key)
}
private onClick (item: CityItem): void {
console.log(item)
}
private handleActionClick (): void {
if (!this.state.value) {
return
}
this.setState({
value: ''
})
this.scrollIntoView && this.scrollIntoView(this.state.value.toUpperCase())
}
private handleChange (value: string): void {
this.setState({
value
})
}
public render (): JSX.Element {
return (
{/* 基础用法 */}
{ this.scrollIntoView = fn }}
>
用户自定义内容
)
}
}
Contributor guide
Assessment
This issue has not been assessed yet.