<el-form
:model="formUpload"
ref="formUploadRef"
:rules="rulesUpload"
label-width="99px"
:inline="false"
size="normal"
@keypress.native.enter.prevent="handleEnterPress"
>
<el-form-item label="教案名称:" prop="name">
<el-input
v-model="formUpload.name"
maxlength="30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="上传教案:" size="normal" prop="type">
<el-select
v-model="formUpload.type"
placeholder="请选择"
clearable
filterable
style="width: 100%"
@change="changeType"
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="formUpload.type == 'ppt'"
label="上传pdf:"
size="normal"
prop="url"
>
<el-upload
class="upload-demo"
:loading="loadingFile"
action="#"
:on-remove="handleRemove"
multiple
:limit="1"
:on-exceed="handleLimit"
:on-success="handleSuccess"
:before-upload="beforeUploadFilePdf"
:file-list="fileList"
:http-request="uploadHandle"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">上传pdf文件</div>
</el-upload>
</el-form-item>
<el-form-item
v-if="formUpload.type == 'word'"
label="上传word:"
size="normal"
prop="url"
>
<el-upload
class="upload-demo"
:loading="loadingFile"
action="#"
:on-remove="handleRemove"
multiple
:limit="1"
:on-exceed="handleLimit"
:on-success="handleSuccess"
:before-upload="beforeUploadFile"
:file-list="fileList"
:http-request="uploadHandle"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">上传word文件</div>
</el-upload>
</el-form-item>
<el-form-item label="" size="normal">
<el-button @click="addEditDialog = false">取消</el-button>
<el-button type="primary" ref="confirmBtn" @click="enterAdd"
>确认</el-button
>
</el-form-item>
</el-form>
methods: {
handleEnterPress(event) {
// 阻止默认行为
event.preventDefault();
// 手动触发表单提交操作
this.enterAdd();
},
enterAdd(){
//提交操作
}
}