//在组件内设置ref:
ref={ref => { this['Item' + '索引' ] = ref }}
// 调用组件:
let ref = 'Item' + '索引';
this[ref].setSelected();
网友评论