React使用css module和className多类名设置

Posted on 2022-04-22 14:39  凡凡0410  阅读(213)  评论(0编辑  收藏  举报

写法一:使用字符串模板的写法

<GridLayout className={`${HomeStyle['grid-div']} layout`}  ></GridLayout>
 
写法二:join("")
 
<GridLayout className={['layout',flag?'active':''].join(' ')}  ></GridLayout>
 

Copyright © 2024 凡凡0410
Powered by .NET 9.0 on Kubernetes