vue-styled-components icon indicating copy to clipboard operation
vue-styled-components copied to clipboard

Is there anyone who understands what are the advantages of this type of library?

Open esbylan opened this issue 1 year ago • 7 comments

以前没用过这类css in js的库,看了下文档觉得写法很新颖很酷,调用方式看起来也很清晰直观,还有就是维护某些动态样式可能会比较舒服,除此之外 有没有重度使用者讲讲这个优势或者典型应用场景是什么(比如相比于直接写css或者sass、less,或者动态绑定行内样式,是否存在某个场景,用这类写法能让代码更优雅或者更易维护)(´・_・`)

esbylan avatar May 10 '24 04:05 esbylan

👋 @esbylan, Thanks for submitting your issue. We'll look into it and keep you updated on our progress. Let us know if you have any questions.

github-actions[bot] avatar May 10 '24 04:05 github-actions[bot]

emmm...我感觉使用在ui库开发可能更合适,css in js适合组合式调用,之前有去开发过一个组件库,用的sass,变量维护起来特别灾难,各种变量嵌套/组合使用起来都特别麻烦

akinoccc avatar May 10 '24 04:05 akinoccc

emmm...我感觉使用在ui库开发可能更合适,css in js适合组合式调用,之前有去开发过一个组件库,用的sass,变量维护起来特别灾难,各种变量嵌套/组合使用起来都特别麻烦

有道理,仔细想想如果无脑抛弃写样式表,把整个页面的样式全部写在js,那js部分就特别臃肿了,然后大部分需求用简单的动态样式就能搞定,用这类css in js有点大炮打蚊子的意味,确实比较适合组件库开发

esbylan avatar May 10 '24 05:05 esbylan

emmm...我感觉使用在ui库开发可能更合适,css in js适合组合式调用,之前有去开发过一个组件库,用的sass,变量维护起来特别灾难,各种变量嵌套/组合使用起来都特别麻烦

有道理,仔细想想如果无脑抛弃写样式表,把整个页面的样式全部写在js,那js部分就特别臃肿了,然后大部分需求用简单的动态样式就能搞定,用这类css in js有点大炮打蚊子的意味,确实比较适合组件库开发

对于业务而言,用来封装通用业务组件还是挺爽的,不过这个就见仁见智了哈哈

akinoccc avatar May 10 '24 05:05 akinoccc

对于业务而言,用来封装通用业务组件还是挺爽的,不过这个就见仁见智了哈哈

懂了,这让我联想起某文档的一段话😄 image

esbylan avatar May 10 '24 05:05 esbylan

Great topic, I've been confused about this too. I feel enlightened now, thank you.

linlifeng1995 avatar May 10 '24 06:05 linlifeng1995

Great topic, I've been confused about this too. I feel enlightened now, thank you.

It's happy to be able to help you!😀

akinoccc avatar May 10 '24 06:05 akinoccc