如果在转换之前完成ajax,我需要显示微调器至少2秒.
我有以下但不工作
route: {
data(transition) {
this.getDelayedData();
transition.next();
}
},
methods:{
getSliders(){
this.$http.get('/api/sliders/getsliders')
.then(sliders =>{this.sliders = sliders.data
});
},
getPosts(){
this.$http.get('/api/posts/getposts')
.then(posts =>{this.posts = posts.data.data
});
},
getDelayedData(){
function timer() {
var dfd = $.Deferred();
setTimeout(function()
{
console.log("done");
}, 2000,dfd.resolve);
return dfd.promise();
}
$.when( this.getPosts(), this.getSliders(),timer() )
.done();
}
}
Run Code Online (Sandbox Code Playgroud)
我试图实现读这篇文章的代码但是$ .when函数不会等到setTimeout函数执行完毕.
我想移动一些文件
Storage::move('posts/temp/'.$val,'photos/'.$post->id.'/'.$val);
Run Code Online (Sandbox Code Playgroud)
但它给了我
File not found at path: home/vagrant/Code/......
Run Code Online (Sandbox Code Playgroud)
有什么特殊的配置需要寻找吗?顺便说一句,该文件确实位于未找到的路径中。