1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/thoughtworks-taro-testing-library

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
class-component.tsx 799
Копировать Редактировать Исходные данные Просмотреть построчно История
jiachen Отправлено 5 лет назад a182c08
import Taro, { Component } from '@tarojs/taro';
import { Text } from '@tarojs/components';
import { StandardProps } from '@tarojs/components/types/common';
interface CounterProps extends StandardProps {
initial?: number;
}
interface CounterState {
count: number;
}
class Counter extends Component<CounterProps, CounterState> {
static defaultProps = {
initial: 1
}
static externalClasses = ['custom-class'];
constructor(props: CounterProps) {
super(props);
this.state = {
count: props.initial as number
}
}
render() {
const { count } = this.state
return (
<Text
onClick={() => {this.setState({
count: count + 1
})}}
className="number custom-class"
>{count}</Text>
)
}
}
export default Counter;

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/thoughtworks-taro-testing-library.git
git@gitlife.ru:oschina-mirror/thoughtworks-taro-testing-library.git
oschina-mirror
thoughtworks-taro-testing-library
thoughtworks-taro-testing-library
v1.0.1