生命周期 一进来就会 运行
componentDidMount= (newProps: any) => {
console.log(37);
};
修改数据
先在 this.state
进行配置
constructor(props: RecipePropsType) {
super(props);
this.state = {
stateActive: 1, // 进行配置
// selectMode: 'cook_mode',
};
}
修改
changeTable = (data: any) => {
// console.log(this.stateActive);
this.setState({
stateActive: data });
};
获取
this.state.stateActive
涂鸦 Picker
官网地址
<Picker
style={
{
//安卓样式
width: cWidth,
height: cx(211),
backgroundColor: 'transparent',
}}
itemStyle={
{
// ios 样式
width: cWidth,
height: cx(211),
fontSize: cx(18),
color: '#000000',
fontWeight: '500',
backgroundColor: 'red',
}}
textSize={
cx(18)}
itemTextColor="#000000"
fontWeight="500"
visibleItemCount={
6} // 可视区域项目个数
selectedValue={
value} //选中的数值
onValueChange={
(val) => {
// 数值改变回调
}}
>
{
pickData.map((items: any) => ( // 多列选择器
<Picker.Item key={
items.value} value={
items.value} label