mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-09-09 20:28:25 +08:00
Update index.vue
复用此组件时因为id不可重复的问题会导致onSuccess指向错误。
This commit is contained in:
parent
b2c9eb4f7b
commit
1e65175152
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<input class="excel-upload-input" ref="excel-upload-input" type="file" accept=".xlsx, .xls" @change="handleClick">
|
||||
<input ref="excel-upload-input" class="excel-upload-input" type="file" accept=".xlsx, .xls" @change="handleClick">
|
||||
<div class="drop" @drop="handleDrop" @dragover="handleDragover" @dragenter="handleDragover">
|
||||
Drop excel file here or
|
||||
<el-button :loading="loading" style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">Browse</el-button>
|
||||
@ -56,7 +56,6 @@ export default {
|
||||
e.dataTransfer.dropEffect = 'copy'
|
||||
},
|
||||
handleUpload() {
|
||||
// document.getElementById('excel-upload-input').click()
|
||||
// 改成这样的原因是避免复用改组件时,调用onSuccess时的指向错误。
|
||||
// 因为之前代码为id取值,复用组件时会导致id重复,错误。所以去掉id取值,改为refs,样式用class解决。
|
||||
this.$refs['excel-upload-input'].click();
|
||||
|
Loading…
x
Reference in New Issue
Block a user