computed()
Computed properties are defined as no-argument functions
参考:
computed同士なら this.foo で定義した computed 同士で値にアクセスできる
computed: {
loadedUser() {
return this.$store.getters.loadedUser(this.$route.params.userName);
},
id() {
return this.loadedUser.id;
}
},
data や method から this.loadedUser.id とアクセスしようとしても
Cannot read property 'id' of undefined
エラーが出る