Answer the question
In order to leave comments, you need to log in
How to load components in vue depending on server response?
What is available:
1) vue file ( naturally, something is wrong here, please help .. )
<template >
<div class="app" >
{{dataArticle}} //подгружаем сюда сгенерированые данные
</div>
</template>
<script>
import LoadFunctions from '@/services/LoadFunctions'
export default {
name: 'settings',
data () {
return {
dataArticle: ''
}
},
mounted () {
this.getArticle('10') // хочу получить статью номер 10
},
methods: {
async getArticle (data) { // выполняем функцию из mounted
const response = await LoadFunctions.getArticle(data) // отправляем запрос
this.dataArticle = response.data // получаем данные
}
}
}
</script>
export default {
getArticle (data) {
return Api().post('getArticle', data)
}
}
data: {
used_component: 'article_with_video',
component_data: {
header: 'Заголовок',
text: 'Текст статьи',
video_url: 'http ссылка'
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question