react 动态操作className
一 、react 动态操作className
方案一:(改变style)
style={activeStoreId === item.id ? { background: '#f5f5f5' } : {}}
方案二:(直接操纵className)
className={activeStoreId === item.id ? "bgblue": "bgred"}
二、动态操作多个className
className={["text-24", activeStoreId === item.id?"h-300":"h-100"].join(' ')}

浙公网安备 33010602011771号