chengkun
2025-09-09 1ff9e27b020822168a95edd83be567e7153837f3
public/static/vue/mixin.js
@@ -14,18 +14,18 @@
                { id: 2, name_loc: 'English', symbol: 'en-us' },
                // { id: 3, name_loc: 'ar', symbol: 'ar' },
            ],
            currentLang: '',
            currentLang: 'zh-cn',
            i18n: i18n.global, // 引入i18n实例
        }
    },
    // 生命周期 - 创建完成(可以访问当前this实例)
    mounted() {
        this.currentLang = this.i18n.locale || 'zh-cn';
    },
    // 创建生命周期
    created() {
        this.currentLang = this.i18n.locale || 'zh-cn';
    },
    // 方法
@@ -33,7 +33,8 @@
        ///// 切换语言 /////
        changeLanguage(newLang) {
            this.i18n.locale = newLang;
            this.i18n.currentLocale = newLang;
            // this.i18n.currentLocale = newLang;
            this.currentLocale = newLang;
            localStorage.setItem('changjiang-park-lang', newLang);
            window.location.reload();
        },