Refresh the page problem after selecting the select of vue-element

the language switching function is needed in the development of the project, and the style is implemented by vue-element "s select selector. The
code is as follows:
< div class= "language" >

<el-select v-model="value" @change="currentSel">
    <el-option
    v-for="item in options"
    :key="item.value"
    :label="item.label"
    :value="item.value">
    </el-option>
</el-select>

< / div >
data () {
return {

options: [{
  value: "",
  label: ""
},
{
  value: "",
  label: ""
}, {
  value: "English",
  label: "English"
}],
value: ""

}
},
methods: {

currentSel(selVal){
    if(selVal === ""){
        // this.value = selVal
        this.$i18n.locale="zhCHS"
        console.log("");
    }else if(selVal === ""){
        this.$i18n.locale="zhCHT";
        console.log("");
    }else if(selVal === "English"){
        this.$i18n.locale="en";
        console.log("English");
    }
}

}
Note: the default language of $i18n set in main.js is simplified Chinese

the above code works normally. When you click to switch languages, the page can switch between different languages normally. For example, when you switch to English mode (English can be displayed normally at this time), then refresh the interface and return to the default simplified Chinese mode

.

how can I save the status of the user switching languages so that it will not be reset as the interface is refreshed

may ask more rookie, but can not figure out how to operate, hope that the boss will not hesitate to give advice, thank you!
or provide other ways to solve

Apr.08,2022

options: [{
  value: 'zhCHS',
  label: ''
},
{
  value: 'zhCHT',
  label: ''
}, {
  value: 'en',
  label: 'English'
}],
value: 'zhCHS'


created(){
    this.value = this.$i18n.locale
}

https://www.jianshu.com/p/dbe...


if you want to retain the selected language after refresh, you need to cache the user cache, so you need to use browser cache. cookie and localStorage can be selected according to your needs. Then each time it is initialized in the entry file main.js , the cache is read first, and if it exists, it is initialized to the cache value. If not, it is set to the default value.


for caching, using localStorage, sessionstorage, etc.

Menu