After the browser page refreshes, data recovers.

In

Vue.js, refresh the page and the data in data will be restored.

data(){
  return {
    value: "",
  }
},

I have a component"s data data value,. When I"m in this component, I use button events to add data to it

  click_btn(){
    this.value = this.value + "123"
  }
  

but when I refresh the browser page, it reverts to the previous empty string. How to solve this problem?

Mar.03,2021

click_btn(){
    this.value = this.value + '123'
    window.sessionStorage.setItem('val',this.value)
  }
mounted(){
    if(window.sessionStorage.getItem('val')){
        this.value = window.sessionStorage.getItem('val');
    }
}
The data in

data is stored in memory, and will definitely be recovered after refreshing. It can only be persisted, and can only be stored in localstorage or cookie

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1af2f-33243.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1af2f-33243.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?