javascript - vue element-ui 上傳文件組件怎么使用
問題描述
請(qǐng)問element-ui的上傳組件怎么使用,最好有demo可以看一下,官網(wǎng)的實(shí)在沒看懂!謝謝了
問題解答
回答1:<el-upload action='//jsonplaceholder.typicode.com/posts/' :on-preview='handlePreview' :on-remove='handleRemove' :file-list='fileList'> <el-button size='small' type='primary'>點(diǎn)擊上傳</el-button> <p slot='tip' class='el-upload__tip'>只能上傳jpg/png文件,且不超過500kb</p></el-upload><script> export default { data() { return {fileList: [{name: ’food.jpeg’, url: ’https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100’}, {name: ’food2.jpeg’, url: ’https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100’}] }; }, methods: { handleRemove(file, fileList) {console.log(file, fileList); }, handlePreview(file) {console.log(file); } } }</script>
官網(wǎng)的代碼直接用,然后在后臺(tái)接口去接受處理文件不久ok了嗎
相關(guān)文章:
1. 關(guān)于docker下的nginx壓力測(cè)試2. debian - docker依賴的aufs-tools源碼哪里可以找到啊?3. 為什么我ping不通我的docker容器呢???4. angular.js - angular內(nèi)容過長(zhǎng)展開收起效果5. javascript - webpack熱加載配置不生效6. javascript - js代碼獲取驗(yàn)證碼倒計(jì)時(shí)問題7. docker start -a dockername 老是卡住,什么情況?8. 主從備份 - 跪求mysql 高可用主從方案9. dockerfile - [docker build image失敗- npm install]10. java - instance method中 static后的<K>是什么意思?
