webstorm怎么设置支持.vue文件的代码自动格式化!

webstorm怎么设置支持.vue文件的代码自动格式化??

阅读 22.9k
4 个回答

第一步:添加File Type

为.vue文件添加为HTML type。这样就能将.vue文件识别为html类型,并进行格式化。
clipboard.png

第二步:scss格式化

如果你再.vue中使用了scss语法,那么还需要设置<style>的属性rel="stylesheet/scss" type="text/css"

<style scoped lang='scss' rel="stylesheet/scss" type="text/css">

script 和 style 代码块写明 type 和 rel 就可以了

<template>
  <div>

  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    props: []
  }
</script>

<style lang="less" rel="stylesheet/less" scoped>

</style>
新手上路,请多包涵

使用插件, 插件搜索里面搜索关键字 vuejs, 安装评分高的那个。

新手上路,请多包涵
<style type="text/stylus" rel="stylusheet/stylus">

style标签需要写type=“text/stylus”不然不支持

推荐问题