javascript - 在 Vscode 中编辑 Typescript 文件中的 css 代码时,所有文本都是红色的,我该如何解决这个问题?
问题描述
这是正在发生的事情的图片 [1]:https ://i.stack.imgur.com/9yXUJ.png 这是代码。
export const GlobalStyle = createGlobalStyle`
html {
height: 100%;
}
body {
background-image: url(${BGImage});
background-size: cover;
margin: 0;
padding: 0 20px;
display: flex;
justify-content: center;
}
* {
font-family: 'Catamaran', sans-serif;
box-sizing: border-box;
}
`;
解决方案
扩展vscode-styled-components可以帮助格式化和着色样式组件中的代码或不同文件中的类似代码,包括.tsx
,上面的示例对我来说如下所示:
红色下划线是由于缺少带下划线的变量的 TypeScript 类型/函数。
推荐阅读
- git - 用另一个远程 git 分支完全替换一个远程 git 分支的最佳方法是什么?
- wordpress - 在 Wordpress 中创建表单
- html - 当滑块包含两列时,如何在响应式设计中设置滑块控件?
- ruby-on-rails - Gem:Ext::BuildError: ERROR: Failed to build gem native extension on Mac
- python - Odoo13:我如何与另一个模型中的 Many2many 字段相关联?
- flask - 如何在烧瓶蓝图中检查管理员信用
- c++ - 如果串行接收器执行时间不同,如何确保接收到正确的数据
- r - 切换功能?
- sql - 创建表 T-SQL 时出错“',' 附近的语法不正确。”
- excel - 解决 x64 位限制 - Worksheet.change