i18n
Everright-formEditor has built-in internationalization support, with both Chinese and English translations available, The default language used in Everright-formEditor is Chinese. it is based on the props. lang to implement, an event listener for "lang" needs to be added and then passed to the editor.
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>