kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js
https://kazupon.github.io/vue-i18n/
MIT License
7.24k stars 860 forks source link

import js as a configuration file in vue, but the imported module will not be reloaded when switching between English and Chinese #1654

Open 774274680 opened 1 year ago

774274680 commented 1 year ago

Clear and concise description of the problem

test.vue

<template>
  <div>
    <el-pagination
      :page-sizes="[100, 200, 300, 400]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
    >
    </el-pagination>
    <button @click="changeLangue">点击切换语言</button>
    <my-form v-bind="formConfig" v-model="formData"></my-form>
  </div>
</template>
<script>
import formConfig from './form-config'
export default {
  data() {
    return {
      formConfig,
    }
  },
</script>

form-config.js

import i18n from '@/language'
const formConfig = {
  formItems: [
    {
      type: 'input',
      prop: 'name',
      label: i18n.t('name'),
      placeholder: i18n.t('nameRequire'),
    },
  ],
  labelWidth: '120px',
}

export default formConfig

Suggested solution

js

Alternative

No response

Additional context

No response

Validations

appleqzw commented 4 months ago

I'm having the same problem, is there a solution at the moment?