Skip to content

配置项

PropTypeDefault
expressionString (必须值)-
displayModeBooleanfalse
output'mathml' / 'html' / 'htmlAndMathml''htmlAndMathml'
leqnoBooleanfalse
fleqnBooleanfalse
throwOnErrorBooleanfalse
errorColorString'#cc0000'
macrosObject-
minRuleThicknessNumber-
colorIsTextColorBooleanfalse
maxSizeNumberInfinity
maxExpandNumber1000
strictBoolean / 'warn' / 'error' / 'ignore' / Function'warn'
trustBooleanfalse
globalGroupBooleanfalse

详细请见 KaTeX 文档

设置全局配置

可在 main.ts 中设置全局配置

ts
import {createApp} from 'vue'
import KatexVue from 'katex-vue'

const app = createApp()
app.use(KatexVue, {
    // 在此处设置您的全局配置
    displayMode: true,
    errorColor: '#ff5500'
})
app.mount('#app')

设置组件配置

vue

<template>
  <katex-vue
      expression="\int_0^1x^2\mathrm{d}x"
      displayMode
      output="mathml"
      ...
  />
</template>