Taro 事件绑定方法
import Taro, { Component } from '@tarojs/taro'
import { View, Text,Button} from '@tarojs/components'
import './index.scss'
export default class Index extends Component {
constructor () {
super(...arguments)
this.state = {
title: '首页',
}
}
add = (e) => {
e.stopPropagation();
this.setState({
title: 'home'
})
}
render () {
return (
<View className='index'>
<View className='title'>{this.state.title}</View>
<View className='content'>
<Button className='add' onClick={this.add()}>添加</Button>
</View>
</View>
)
}
}