成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

javascript - vue element-ui 上傳文件組件怎么使用

瀏覽:161日期:2023-06-08 09:24:13

問(wèn)題描述

請(qǐng)問(wèn)element-ui的上傳組件怎么使用,最好有demo可以看一下,官網(wǎng)的實(shí)在沒看懂!謝謝了

問(wèn)題解答

回答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文件,且不超過(guò)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了嗎

標(biāo)簽: JavaScript
相關(guān)文章: