| | |
| | | </div> |
| | | <!-- 真正的上传按钮--> |
| | | <div> |
| | | <label class="upload" ref="androidInputFileImage"> |
| | | <!-- <label class="upload" > --> |
| | | <input |
| | | class="sr-only" |
| | | style="display: none; cursor: pointer" |
| | | style="cursor:pointer" |
| | | type="file" |
| | | id="androidInputFileImage" |
| | | |
| | | |
| | | ref="androidInputFileImage" |
| | | @change="handlePhotoChange($event, 1)" |
| | | accept="image/jpg, image/jpeg, image/png" |
| | | /> |
| | | </label> |
| | | <label class="upload" ref="androidInputFileCapture"> |
| | | <!-- </label> --> |
| | | <!-- <label class="upload" > --> |
| | | <input |
| | | class="sr-only" |
| | | style="display: none; cursor: pointer" |
| | | style="cursor:pointer" |
| | | type="file" |
| | | id="androidInputFileCapture" |
| | | |
| | | |
| | | ref="androidInputFileCapture" |
| | | @change="handlePhotoChange($event, 2)" |
| | | accept="image/*" |
| | | capture="camera" |
| | | /> |
| | | </label> |
| | | <!-- </label> --> |
| | | </div> |
| | | <!--选择上传图片还是拍照--> |
| | | <van-action-sheet |
| | |
| | | }, |
| | | // 选择拍照或者相册选项 |
| | | handleMenuSelect(item, index) { |
| | | console.log(this.$refs.androidInputFileCapture.click(), index); |
| | | console.log(this.$refs); |
| | | console.log(this.$refs.androidInputFileCapture); |
| | | console.log(this.$refs.androidInputFileImage); |
| | | console.log(document.getElementById('androidInputFileCapture')); |
| | | if (index === 0) { |
| | | // this.$refs.androidInputFileCapture.dispatchEvent( |
| | | // new MouseEvent("click") |
| | | // ); |
| | | this.$refs.androidInputFileCapture.click(); |
| | | this.$nextTick(()=>{ |
| | | this.$refs.androidInputFileCapture.click(); |
| | | }) |
| | | } else { |
| | | // this.$refs.androidInputFileImage.dispatchEvent(new MouseEvent("click")); |
| | | this.$refs.androidInputFileImage.click(); |
| | | this.$nextTick(()=>{ |
| | | this.$refs.androidInputFileImage.click(); |
| | | }) |
| | | } |
| | | this.selectModel = false; |
| | | }, |