1. 程式人生 > >elemet-ui後臺呼叫選擇圖片後直接返回縮圖地址(在後臺recommendedit.vue裡)

elemet-ui後臺呼叫選擇圖片後直接返回縮圖地址(在後臺recommendedit.vue裡)

uploadImg: function () {

        //初始化

        var imgLen = this.editForm.fdcImage.length

        this.$eventhub.$emit('photoInit', 'more', (res) => {

            if(imgLen <6){

                for(var i=0; i<res.length; i++){

                    if(imgLen <6){

                        //this.editForm.fdcImage.push(res[i].thumbImage) //選擇圖片時直接返回縮圖

                        this.editForm.fdcImage.push(res[i].fdcImage) //選擇圖片時直接返回原圖

                        imgLen++

                    }else{

                        this.$message({

                            message: '最多隻能新增6張圖片!',

                            type: 'warning'

                        });

                        break;

                    }

                }

            }else{

                this.$message({

                    message: '最多隻能新增6張圖片!',

                    type: 'warning'

                });

            }

        })

    },