小编Fer*_*cho的帖子

如果ajax在transition.next()之前使用Vue.js完成,则至少等待2秒

如果在转换之前完成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函数执行完毕.

javascript jquery vue.js

7
推荐指数
1
解决办法
3341
查看次数

Storage::move 给出“在路径中找不到文件:” Laravel 和 Ubuntu

我想移动一些文件

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)

有什么特殊的配置需要寻找吗?顺便说一句,该文件确实位于未找到的路径中。

ubuntu laravel

3
推荐指数
1
解决办法
6902
查看次数

标签 统计

javascript ×1

jquery ×1

laravel ×1

ubuntu ×1

vue.js ×1