| | |
| | | <!-- |
| | | * @Date: 2019-08-30 18:04:49 |
| | | * @LastEditors: zxq |
| | | * @LastEditTime: 2022-08-04 15:49:56 |
| | | * @LastEditTime: 2022-08-05 14:59:31 |
| | | * @Description: |
| | | --> |
| | | <template> |
| | |
| | | </div> |
| | | <!-- 真正的上传按钮--> |
| | | <div> |
| | | <input |
| | | style="display:none;cursor:pointer;" |
| | | type="file" |
| | | id='androidInputFileImage' |
| | | ref="androidInputFileImage" |
| | | @change="handlePhotoChange($event,1)" |
| | | accept="image/jpg, image/jpeg, image/png" |
| | | /> |
| | | <input |
| | | style=" display:none;cursor:pointer;" |
| | | type="file" |
| | | id='androidInputFileCapture' |
| | | ref="androidInputFileCapture" |
| | | @change="handlePhotoChange($event,2)" |
| | | accept="image/*" |
| | | capture="camera" |
| | | /> |
| | | |
| | | |
| | | </div> |
| | | <!--选择上传图片还是拍照--> |
| | | <van-action-sheet |
| | | <!-- <van-action-sheet |
| | | v-model="selectModel" |
| | | :close-on-click-overlay="false" |
| | | cancel-text="取消" |
| | | :actions="nav" |
| | | @select="handleMenuSelect" |
| | | ></van-action-sheet> |
| | | ></van-action-sheet> --> |
| | | <van-action-sheet v-model="selectModel" cancel-text="取消" title="上传身份证"> |
| | | <div class="content"> |
| | | <div class="upload_input"> |
| | | <div>拍照</div> |
| | | <input |
| | | style="cursor:pointer;width:100%;opacity:0;" |
| | | type="file" |
| | | id='inputFileCapture' |
| | | ref="androidInputFileCapture" |
| | | @change="handlePhotoChange($event,2)" |
| | | accept="image/*" |
| | | capture="camera" |
| | | /> |
| | | </div> |
| | | <div class="upload_input"> |
| | | <div>本地相册上传</div> |
| | | <input |
| | | style="cursor:pointer;width:100%;opacity: 0;" |
| | | type="file" |
| | | id='inputFileImage' |
| | | ref="androidInputFileImage" |
| | | @change="handlePhotoChange($event,1)" |
| | | accept="image/jpg, image/jpeg, image/png" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </van-action-sheet> |
| | | <!-- <button @click="onclick">aa</button> --> |
| | | </div> |
| | | </template> |
| | |
| | | data() { |
| | | return { |
| | | selectModel: false, // 模态窗选择拍照还是相册 |
| | | nav: [{ name: "拍照" }, { name: "从手机相册选择" }], |
| | | nav: [{ name: "拍照",code:0 }, { name: "从手机相册选择",code:1 }], |
| | | picList: [{}, {}], |
| | | picZ: {}, |
| | | picF: {}, |
| | |
| | | this.selectModel = true; |
| | | }, |
| | | // 选择拍照或者相册选项 |
| | | handleMenuSelect(item, index) { |
| | | console.log(this.$refs.androidInputFileCapture.click(),index) |
| | | handleMenuSelect(index) { |
| | | console.log( this.$children[0] ) |
| | | if (index === 0) { |
| | | this.$refs.androidInputFileCapture.click(); |
| | | } else { |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="less" scoped > |
| | | <style lang="less" > |
| | | .component-photo-upload { |
| | | .upload_input{ |
| | | font-size: 16px; |
| | | width: 100%; |
| | | height: 45px; |
| | | position: relative; |
| | | text-align: center; |
| | | input{ |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | } |
| | | } |
| | | .pic-title { |
| | | h4 { |
| | | padding: 10px 0; |
| | |
| | | line-height: 1; |
| | | color: #333; |
| | | font-weight: normal; |
| | | |
| | | } |
| | | } |
| | | |