을
export default {
computed: mapState({
chatStore: state => store.state;
}),
created() {
this.$store.dispatch('conversationlist')
/*this loads the conversations and i assign the values to the
DOM (ul > li) when the ul>li is clicked it calls
onCLickGetConversationMesseges() */
if (this.chatStore.conversationlist.length == 0) {
/*when i console log this its return a null length value
until i double click */
}
},
methods: {
onCLickGetConversationMesseges() {
this.$store.dispatch('setSelectedConversation')
if (this.chatStore.messageList.length == 0) {
/*when i console log this its return a null length value
until i double click */
}
}
}
<template></template>
<style scoped></style>
도움을 주시기 바랍니다 밖으로 말을하려고 무엇을
이, 당신은 행동 코드를 게시하지 않았기 때문에 내가 확실히 말할 수는 없지만 가정 이러한 동작은 비동기입니다.
export default {
computed: mapState({
chatStore: state => store.state;
}),
created() {
this.$store.dispatch('conversationlist').then(() => {
/*this loads the conversations and i assign the values to the
DOM (ul > li) when the ul>li is clicked it calls
onCLickGetConversationMesseges() */
if (this.chatStore.conversationlist.length == 0) {
/*when i console log this its return a null length value
until i double click */
}
})
},
methods: {
onCLickGetConversationMesseges() {
this.$store.dispatch('setSelectedConversation').then(() => {
if (this.chatStore.messageList.length == 0) {
/*when i console log this its return a null length value
until i double click */
}
})
}
}
<template></template>
<style scoped></style>
:
그래서 당신은 이러한 작업에서 약속을 반환 한 다음 코드를 변경해야