gpt4 book ai didi

vue.js - Vuejs Axios 数据未显示

转载 作者:搜寻专家 更新时间:2023-10-30 22:47:16 25 4
gpt4 key购买 nike

获取信息延迟不显示的问题,我需要任何帮助来解决这个问题。

        <h1>@{{message}}</h1>

<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-md-10"><h3 class="panel-title">Experience</h3></div>
<div class="col-md-2 text-right">
<button class="btn btn-success">Ajouter</button>
</div>
</div>

</div>
<div class="panel-body" >

<ul class="list-group">
<li class="list-group-item" v-for="experience in experiences" >
<div class="pull-right">
<button class="btn btn-warning btn-sm">Editer</button>
</div>
<h3>@{{experience.titre}}</h3>
<p>@{{experience.body}}</p>
<small>@{{experience.debut}} - @{{experience.fin}}</small>
</li>

</ul>

</div>
</div>

Vuejs

<script src="{{asset('js/vue.js')}}"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Nawfal Kharbouch',
experiences:[]
},
methods:{
getExperiences:function(){
axios.get('http://localhost:8080/getexperiences').then(response=>{
this.experiences=response.data;
console.log(this.experiences);
}).catch(function(error){
console.log('erros : ',error);
})
}
},
mounted:function(){
this.getExperiences();
console.log(this.experiences);
}
})
</script>

获取信息延迟不显示的问题,我需要任何帮助来解决这个问题。//控制台谷歌浏览器

[__ob__: Observer]
vue.js:8553 You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
backend.js:1 vue-devtools Detected Vue v2.5.16
5:171 (3) [{…}, {…}, {…}, __ob__: Observer];

//图片view vide

最佳答案

您需要将它传递给一个变量,而不是直接使用它。

methods:{
getExperiences:function(){
var vm = this
axios.get('http://localhost:8080/getexperiences').then(response=>{
vm.experiences=response.data;
console.log(vm.experiences);
}).catch(function(error){
console.log('erros : ',error);
})
}
},

关于vue.js - Vuejs Axios 数据未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51632733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com