Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

element-ui中upload组件不显示上传文件名字是什么原因?

现象是这样:
图片描述

代码如下:

<el-dialog
    title="提交资料"
    :visible.sync="dialogImmediateOrder"
    size="tiny"
    :show-close="false">
    <el-form :model="submitForm" ref="submitForm" label-width="80px" v-for="(i, index) in submitForm.detail" :key="index">
        <span class="title" >重要调查资料</span><span class="delete" @click.prevent="deleteData(index)" style="color: #8F8E94">删除</span>
        <el-form-item label="调查路径" class="m-y-t-2">
            <el-select v-model="i.pathWay" placeholder="请选择调查路径" style="width: 100%" size="small">
                <el-option
                    v-for="p in pathList"
                    :label="p.codeName"
                    :value="p.codeValue"
                    :key="p.codeValue">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="调查描述">
            <el-input type="textarea" v-model="i.description" :rows="4" size="small" placeholder="请输入调查描述"></el-input>
        </el-form-item>
        <el-form-item label="调查描述">
            <el-upload
                class="upload-demo"
                action="ias-web/file/fileUpload"
                :file-list="i.uploadFileList"
                :on-remove="removeFile"
                :on-success="successUpload">
                <el-button size="" type="text" class="upLink" @click="recordIndex(index)"><i class="el-icon-plus"></i>上传资料</el-button>
            </el-upload >
        </el-form-item>
    </el-form>
    <a @click="addData()" class="add"><i class="el-icon-plus"></i>继续添加资料</a>
    <span slot="footer" class="dialog-footer">
    <el-button @click="dialogImmediateOrder = false">取 消</el-button>
    <el-button type="primary" @click="submitImmediateOrder(submitForm)">确 定</el-button>
    </span>
</el-dialog>

submitForm: {
    receivTaskId: '',
    index: 1,
    detail: [{
        description: '',
        uploadFileList: [],
        pathWay: '',
        index: 1
    }]
},

本来这个upload是没问题的,但是我放在循环里就出问题了,这是为什么?


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

1 Reply

0 votes
by (71.8m points)

因为uploadFileList里面没有name,具体为

uploadFileList:[
    {name:"你要显示的名字",
     ....//其余属性
    },
    ...
]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...