国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Vue觸發input選取文件點擊事件操作

瀏覽:76日期: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'>點擊上傳</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; } }

補充知識: vue下打包時幾個文件選擇文件打包一起 并做懶加載

直接上代碼

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-DeviceManage的文件會被打包在一起

以上這篇Vue觸發input選取文件點擊事件操作就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Vue
相關文章:
主站蜘蛛池模板: 一男一女的一级毛片 | 日本妞xxxxxxxxx69| 免费成人毛片 | 国产精品合集一区二区 | 午夜在线社区视频 | 国产一级大片在线观看 | 亚洲毛片免费看 | 一区二区三区网站在线免费线观看 | 日本黄页网站在线观看 | 国产成人精品一区二区不卡 | 成人午夜影视 | 国产一区二区免费播放 | 欧美精品videosbestsex另类 | 欧美日韩一日韩一线不卡 | 亚州欧美 | 国产免费一区二区三区免费视频 | 手机看片福利在线 | a毛片在线看片免费 | 页面升级亚洲 | 全黄性高视频 | 日本特级淫片免费看 | 久久国产精品国产精品 | 模特视频一二三区 | 午夜在线播放免费人成无 | www.碰| 视频在线观看一区 | 亚洲羞羞裸色私人影院 | 91亚洲精品在看在线观看高清 | 精品欧美一区二区三区四区 | 精品性久久 | 久久在线视频免费观看 | 美女黄影院 | 国内黄色精品 | 久久a热6 | 午夜刺激爽爽视频免费观看 | 性盈盈影院在线观看 | 黄色影院在线观看视频 | 九九热视频精品在线观看 | 午夜爱爱毛片xxxx视频免费看 | 免费一级在线 | 九九亚洲视频 |