Skip to content
On this page

国际化

Everright-formEditor内置了国际化(内部有中文和英文)配置,默认使用中文作为显示语言,由于内部是基于props.lang来实现的,所以需要监听事件为lang,然后传递给编辑器

erFormEditor

html
<script setup>
import { ref } from 'vue'
import { erFormEditor } from 'everright-formeditor'
const lang = ref('zh-cn')
const handleListener = async ({ type, data }) => {
  switch (type) {
    case 'lang':
      lang.value = data
      break
  }
}
</script>
<template>
  <er-form-editor
    :lang="lang"
    @listener="handleListener"
  />
</template>

erFormPreview

html
<script setup>
  import { erFormPreview } from 'everright-formeditor'
</script>
<template>
  <er-form-preview
    lang="zh-cn"
  />
</template>

erFormConfig

html
<script setup>
import { ref } from 'vue'
import { erFormConfig } from 'everright-formeditor'
const lang = ref('zh-cn')
const handleListener = async ({ type, data }) => {
  switch (type) {
    case 'lang':
      lang.value = data
      break
  }
}
</script>
<template>
  <er-form-config
    :lang="lang"
    @listener="handleListener"
  />
</template>