javascript - vue element-ui 上傳文件組件怎么使用
問題描述
請問element-ui的上傳組件怎么使用,最好有demo可以看一下,官網(wǎng)的實在沒看懂!謝謝了
問題解答
回答1:<el-upload action='//jsonplaceholder.typicode.com/posts/' :on-preview='handlePreview' :on-remove='handleRemove' :file-list='fileList'> <el-button size='small' type='primary'>點擊上傳</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)的代碼直接用,然后在后臺接口去接受處理文件不久ok了嗎
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””2. docker - 如何修改運行中容器的配置3. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題4. docker鏡像push報錯5. 前端 - @media query 使用出現(xiàn)的問題?6. 利用IPMI遠(yuǎn)程安裝centos報錯!7. 運行python程序時出現(xiàn)“應(yīng)用程序發(fā)生異常”的內(nèi)存錯誤?8. docker 下面創(chuàng)建的IMAGE 他們的 ID 一樣?這個是怎么回事????9. phpstudy8.1沒集成mysql-front10. html - css氣泡,實現(xiàn)“倒三角(不知道算不算三角了)”可透明的。

網(wǎng)公網(wǎng)安備