vue 请求完接口后执行方法

getLunbo: function() {
                    var that = this;
                    that.lunbo = [];
                    // api.showProgress({
                    //     title: '加载中'
                    // });
                    return flyPost('api/login/shouyelunbo', {
                        _ajax: 1,
                    }).then(function(res) {
                        console.log(JSON.stringify(res))
                        if (res.code == 1) {
                            that.lunbo = res.data;
                //在获取完数据后启动轮播插件 that.$nextTick(
function() { var swiper = new Swiper('.swiper-container', { loop: true, autoplay: 3000, pagination: { el: '.swiper-pagination' }, }); }) // api.hideProgress(); } else { // api.hideProgress(); showAlert({ message:6666666 // message: res.msg }); } }).catch(function(err) { // api.hideProgress(); console.log(err); })

猜你喜欢

转载自www.cnblogs.com/shark1100913/p/11253875.html