午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:162日期: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
相關文章:
主站蜘蛛池模板: 亚洲婷婷网 | 国产精品久久久91 | 一级片视频在线观看 | 亚洲色欲色欲www | 欧洲亚洲一区二区 | 午夜免费观看视频 | 91最新在线视频 | 洗濯屋在线观看 | 中文字幕一区二区不卡 | 亚洲网在线观看 | 亚洲少妇色图 | 99久久99久久精品国产片果冻 | 国产一区久久 | 久久99国产精品视频 | 亚洲视频在线一区 | 久久久国产一区 | 在线免费观看成年人视频 | 欧美一级日韩一级 | 久久激情网 | 日韩视频一区二区三区 | 久久草视频 | 国产一区二区三区四区在线 | 四虎影院永久地址 | 国产精品久久久久久久免费看 | 五月婷婷激情五月 | 国产午夜视频在线观看 | 懂色av一区二区 | 亚洲欧美日韩中文在线 | 视频黄色免费 | 国产成人精品久久二区二区91 | 亚洲精品一区在线 | 四虎影院久久 | 亚洲区一区二 | 日韩成人一级 | 正在播放jul一色桃子026 | 三级天堂| 中文字幕精品视频在线观看 | 国产精品视频在 | 中文字幕免费高 | 97精品视频在线观看 | 欧美精品一区二区三 |