在自闭合标签之前添加空间

reactjs React.js

Stafan

2020-04-03

在基于WebStorm / IntelliJ的产品中,如何在自动结束标记中的结束标记之前包含空格?

默认设置轮流<ReactComp /><ReactComp/>,这是不合规矩的(一个JSX-空间之前关闭的常用AirBNBs的JavaScript风格指南)。

第3971篇《在自闭合标签之前添加空间》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

1个回答
宝儿 2020.04.03

Maybe a little confusingly, the setting is under "HTML" code style and not the JS code style in IntelliJ.

Enable the setting "In empty tag" in Preferences -> Editor -> Code Style -> HTML.

When you do an explicit reformat the space will be added. To ensure that the space is added when autocompleting React components, check the same box in in the Preferences -> Editor -> Code Style -> XML -> Other tab.

Screenshot from 2016-10-12, IntelliJ IDEA 2016.2

在此处输入图片说明

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android