av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

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

Vue觸發(fā)input選取文件點(diǎn)擊事件操作

瀏覽:108日期:2022-12-12 18:43:27

CSS

.upload-btn-box { margin-bottom: 10px; button { margin-right: 10px; } input[type=file] { display: none; }}

HTML

<div class='upload-btn-box'><Button @click='choiceImg' icon='ios-cloud-upload-outline' type='primary'>點(diǎn)擊上傳</Button> <input ref='filElem' type='file' @change='getFile'></div>

Script

choiceImg(){ this.$refs.filElem.dispatchEvent(new MouseEvent(’click’)) },getFile(){ var that = this; const inputFile = this.$refs.filElem.files[0]; if(inputFile){if(inputFile.type !== ’image/jpeg’ && inputFile.type !== ’image/png’ && inputFile.type !== ’image/gif’){ alert(’不是有效的圖片文件!’); return;}this.imgInfo = Object.assign({}, this.imgInfo, { name: inputFile.name, size: inputFile.size, lastModifiedDate: inputFile.lastModifiedDate.toLocaleString()})const reader = new FileReader();reader.readAsDataURL(inputFile);reader.onload = function (e) { that.imgSrc = this.result;} } else {return; } }

補(bǔ)充知識(shí): vue下打包時(shí)幾個(gè)文件選擇文件打包一起 并做懶加載

直接上代碼

const DeviceManage = r => require.ensure([], () => r(require(deviceManagePath + ’main/DeviceManage’)), ’g-DeviceManage’);const SingleDeviceSet = r => require.ensure([], () => r(require(deviceManagePath + ’deviceSet/SingleDeviceSet’)), ’g-DeviceManage’);const ModifyNo = r => require.ensure([], () => r(require(deviceManagePath + ’modifyNo/ModifyNo’)), ’g-DeviceManage’);const PricePerTime = r => require.ensure([], () => r(require(deviceManagePath + ’pricePerTime/PricePerTime’)), ’g-DeviceManage’);const SetParams = r => require.ensure([], () => r(require(deviceManagePath + ’setParams/SetParams’)), ’g-DeviceManage’);const ShowDevicePrice = r => require.ensure([], () => r(require(deviceManagePath + ’showDevicePrice/ShowDevicePrice’)), ’g-DeviceManage’);const parameterSetting = r => require.ensure([], () => r(require(deviceManagePath + ’parameterSetting/parameterSetting’)), ’g-DeviceManage’);const SetParams3G = r => require.ensure([], () => r(require(deviceManagePath + ’setParams3G/SetParams3G’)), ’g-Device3Gparams’);

這么寫 所有g(shù)-DeviceManage的文件會(huì)被打包在一起

以上這篇Vue觸發(fā)input選取文件點(diǎn)擊事件操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 亚洲一区视频 | 91精品国产777在线观看 | 亚洲精品国产综合区久久久久久久 | 日日操夜夜操视频 | 久久亚洲国产精品 | 在线中文字幕第一页 | 成人久草| 色婷婷精品久久二区二区蜜臂av | 国产精品爱久久久久久久 | 中国美女一级黄色片 | 国产伦精品一区二区三区照片91 | 亚洲国产一区二区视频 | 91在线观看免费视频 | 作爱视频免费看 | 亚洲一区二区三区免费在线 | 久久精品亚洲精品国产欧美kt∨ | 日本不卡一区二区三区在线观看 | 婷婷色国产偷v国产偷v小说 | 成人做爰69片免费观看 | 国产一区二区久久久 | 亚洲国产成人久久综合一区,久久久国产99 | 在线区| www.99re| 日韩精品一区二区三区中文字幕 | 欧美日韩视频 | 一级欧美黄色片 | 欧美日韩在线一区二区 | 亚洲天堂影院 | 亚洲欧美第一视频 | 亚洲欧美一区二区在线观看 | 永久av | 国产午夜精品理论片a大结局 | 精品亚洲二区 | 亚洲欧美日本在线 | 日韩欧美在线播放 | 色婷婷久久久久swag精品 | 亚洲一区电影 | 国产精品美女久久久免费 | 成人网av | 日日操操 | 自拍 亚洲 欧美 老师 丝袜 |