1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <template>
- <div>
- <el-upload
- class="upload-demo"
- ref="upload"
- action=""
- :auto-upload="true"
- :on-change="upload"
- :http-request="uploadFile"
- :accept="accept"
- :limit="limit"
- >
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
- </el-upload>
- </div>
- </template>
- <script>
- export default {
- props:{
- accept: {
- type: String,
- default: ""
- },
- limit: {
- type: [String,Number],
- default: 1
- }
- },
- data(){ return {}},
- created(){},
- mounted(){},
- methods:{
- upload(file,fileList){
- console.log(file,fileList,'fileList')
- this.$emit("change",fileList)
- },
- uploadFile(file){
- console.log(file)
- }
- }
- }
- </script>
- <style lang="scss">
- </style>
|