编写js代码时,一保存注释和代码就会跑到一行,或多行代码会变成一行是什么原因,插件的问题吗
(保存时会自动格式化代码)
保存前
<body>
<div id="test"></div>
<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/babel">
// 创建函数式组件
function demo(){ }
</script>
</body>
<script type="text/babel">
const data = ['Angular', 'React', 'Vue'];
const VDOM = (
<div>
<h1>框架列表</h1>
<ul>
{
data.map((item,index) => {
return <li key={index}> {item} </li>
})
}
</ul>
</div>
);
ReactDOM.render(VDOM,document.getElementById("test"));
</script>
保存后
<body>
<div id="test"></div>
<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/babel">
// 创建函数式组件 function demo(){ }
</script>
</body>
<script type="text/babel">
const data = ['Angular', 'React', 'Vue']; const VDOM = (
<div>
<h1>前端JS框架列表</h1>
<ul>
{ data.map((item,index) => { return
<li key={index}> {item} </li>
}) }
</ul>
</div>
); ReactDOM.render(VDOM,document.getElementById("test"));
</script>