Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
535 views
in Technique[技术] by (71.8m points)

请求后台数据时数据拿到了,赋值时控制台报错

控制台报错后台响应页面赋值失败,因为那个报错请教各位大佬,在使用axios请求后端数据的时候数据拿到了,在进行赋值的时候控制台报错Uncaught (in promise) TypeError: Cannot set property 'type' of undefined,我的代码如下:

getList(){  
    getBanner({  
        pageNumber:this.formInline.currentPage,  
        pageSize:this.formInline.pageSize  
    }).then(res=>{  
        this.tableData=res.data;  
        this.total=res.totalNumber  
    })  
},

请问这是怎么回事啊?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你这是element-ui报的错
源码我看是message相关的

['success', 'warning', 'info', 'error'].forEach(function (type) {
    main_Message[type] = function (options) {
        if (typeof options === 'string') {
            options = {
                message: options
            };
        }
        options.type = type;  // 这行报的错
        return main_Message(options);
    };
});

你找找你哪里调用了这个消息提示,应该是出现了这样的情况

this.$message.success(undefined) // 或者是warning等其他的方法

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...