Vue lifecycle and vuex data calls

previously stored the data in vuex, and got it in a page

clipboard.png

clipboard.png

clipboard.png

my guess is that when the page is rendered, the cpmputed does not getter the data at the beginning, so the corresponding attribute cannot be found when the value is assigned, and then the computed will render the value dynamically.

then I call the method in mounted to get the assignment, but still report this error. There is no way of thinking now, please give me a move.

Mar.06,2021

userInfo & & userInfo.username


userInfo give a default value {}


assign the userInfo in vueX to the variable in data


data () {
  return {
    userInfo: {}
  }
}

use data, to modify when adding


give it directly to

    <div class="head" v-if="userInfo">...</div>

Price judgment is fine

Menu