How to use prettier to handle the line breaks of ">" and "{{" or ">" and "}}"?

Viewed 460

environment:

  • vue 2.6.12

  • vscode 1.56.2

  • prettier v6.4.0


when I use Prettier to format my code , it will return

<el-tab-pane
  v-for="(tab, index) in tabs"
  :key="index"
  :label="tab.title"
  :name="tab.name"
  >{{ tab.title }}</el-tab-pane
>

But I actually want this,so I should I can only manually change it :

<el-tab-pane
  v-for="(tab, index) in tabs"
  :key="index"
  :label="tab.title"
  :name="tab.name"
>
  {{ tab.title }}
</el-tab-pane>

Could I just use prettier to achive this goal?

My prettier config is:

module.exports = {
  semi: false,
  singleQuote: true,
  tabWidth: 2,
  bracketSpacing: true,
  endOfLine: 'auto',
  printWidth: 80,
  trailingComma: 'none',
  arrowParens: 'always',
  proseWrap: 'preserve',
  jsxBracketSameLine: true
}

0 Answers
Related