Open liuyunzyj opened 4 years ago
跟官方代码一模一样
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 (
)
} }
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
同样问题+1
同样问题+
跟官方代码一模一样
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 (
} }