javascript - 样式化组件和模板文字
问题描述
有人可以帮助解释这是如何styled.a`aasdasd`
工作的吗?这是有效的 JS 吗?这是什么意思?这是 styled-components
图书馆的代码片段?
const Button = styled.a`
/* This renders the buttons above... Edit me! */
display: inline-block;
border-radius: 3px;
padding: 0.5rem 0;
margin: 0.5rem 1rem;
width: 11rem;
background: transparent;
color: white;
border: 2px solid white;
/* The GitHub button is a primary button
* edit this to target it specifically! */
${props => props.primary && css`
background: white;
color: black;
`}
`
解决方案
推荐阅读
- jquery - jquery将css附加到头部
- c - 如何将程序中定义的默认端口号添加到 getaddrinfo()
- linux - 如何在立即打印时删除流中的新行?
- asp.net-core - 如何修复 dotnet core web api 的数据包不匹配错误和我使用 main web api [jenkins] 引用的测试 api?
- ajax - Fetch 没有从 Rails 控制器返回数据
- java - 建议:使用spring boot的应用程序之间的两种方式通信
- java - 如何在匹配原始字符串的情况下替换字符串中的字符?
- sql-server - SQL Server 在 set 子句中多次指定列名。实体框架问题
- caching - 在 Laravel 5.5 中配置 Redis Sentinel
- python-3.x - 带有 Power BI 的 Windows 中的 Anaconda