uniapp 调用 andriod 接口 获取本地相册 /照相机功能(vue3)

importOrChooseImage.vue

<template><view style="position: fixed;bottom: 0rpx; height: 140rpx;background-color: #FFFFFF; width: 750rpx; border-top: 1rpx solid #FAFBFD;display: flex;flex-direction: row;justify-content: space-between;"><view style="margin-top: 20rpx;padding-left: 60rpx; display: flex;flex-direction: row;"><view style="margin-top: 20rpx;"><image style="width: 40rpx; height: 40rpx;" src="../../static/hxuan.png" mode="aspectFill"></image></view><view style="display: flex;justify-content: center;margin-top: 18rpx;margin-left: 20rpx;"><text style="font-size: 32rpx;font-weight: 600;">全选照片</text></view></view><view @click="chooseImage" style="margin-top: -30rpx;"><image style="width: 140rpx;height: 140rpx;" src="../../static/haddr.png" mode="aspectFill"></image></view><view @click="goToPage('/pages/userlist/userlist')" style="margin-top: 20rpx;padding-right: 60rpx; display: flex;flex-direction: row;"><view style="margin-top: 18rpx;"><image style="width: 42rpx; height: 42rpx;" src="../../static/huser.png" mode="aspectFill"></image></view><view style="display: flex;justify-content: center;margin-top: 18rpx;margin-left: 20rpx;"><text style="font-size: 32rpx;font-weight: 600;">匹配患者</text></view></view></view>
</template><script>export default {setup(props,{emit}){const goToPage = (uri)=> {uni.navigateTo({url:uri})}const chooseImage = (params)=> {uni.chooseImage({count:1000,sizeType:['original','compressed'],sourceType:['camera','album'],  //调用原生相册和原生相机,弹出选择// sourceType:['album'], 直接调用原生相册// sourceType:['camera'], 直接调用原生相机success:(res)=>{// imagepath.value = res.tempFilePaths[0]console.log(res)emit("changeList",res.tempFilePaths)}})}return {goToPage,chooseImage}}}
</script><style lang="scss" scoped>
</style>

import.vue 部分界面

<template>//importOrChooseImage在uniapp 中调用的是app的全局组件 ,所以这里直接调用<importOrChooseImage @changeList="changeList"></importOrChooseImage>
</template>
<script>import {mapGetters,mapActions} from 'vuex';export default {data() {return {show:false,imageList:[]}},onLoad(options) {  },computed:{},methods: {handleBack() {uni.navigateBack({delta: 1,  //返回层数,2则上上页})},changeList(res){//res 返回选中图片的地址 存到sqlite 数据库中this.imageList = [...this.imageList,...res]// console.log("imageList:"+this.imageList)},xshow() {this.show = !this.show;},goToPage(uri) {uni.navigateTo({url:uri})},}}
</script>

uniapp 调用andriod 接口相关推荐

  1. uniapp 调用手机相机拍照实现图片上传

    uniapp 调用手机相机拍照实现图片上传 参考资料:https://blog.csdn.net/weixin_46391646/article/details/108450898 调用相机相册 un ...

  2. 浅析 uniapp(Vue) 的接口封装方法

    浅析 uniapp(Vue) 的接口封装方法 本文将详细讲解封装思路,通过对接口请求进行封装,实现接口引入即用,减少了请求复杂的属性参数,更加关注数据与业务本身. config - 请求地址及相关参数 ...

  3. uniapp调用wx.scanQRCode()方法,安卓手机正常,苹果手机异常的问题

    场景:使用uniapp开发微信公众号网页,调用wx.scanQRCode()方法实现扫码功能,出现安卓手机正常扫码,苹果手机无法扫码,需要手动刷新页面后才可以扫码的问题. 点击菜单跳转路由的逻辑代码, ...

  4. uniapp调用地图,进行位置查询,标记定位

    这周开会又新增一个小功能,就是需要通过身份证号/手机号在地图查询(后台返回经纬度),标记位置,想着挺麻烦,做的时候发现没啥技术,分享给大家. <map class="map" ...

  5. 利用python3 调用zabbix接口完成批量加聚合图形(screens)

    在上一篇博客中,我们完成的利用python3 调用zabbix接口批量增加主机,增加主机的item,增加主机的图形! 接下来我们完成批量增加主机的screen 首先我们要增加screen需要哪些参数呢 ...

  6. java获取get请求返回_Java中处理调用第三方接口(post/get),该如何处理,返回的数据如何处理...

    条件:1.请求URL:http://ip:port/yypt/*.jsonRequest 2.接口采用http post协议.Content-Type为application/json 调用流程: 第 ...

  7. java web项目调用rest接口404

    POST http://localhost:8090/newsadmin/codeitemcontroller/addcodeitem 404 (Not Found) 接口调用了半天发现还是404 头 ...

  8. c调用c++ qt_C++中是如何调用C接口的?

    前言 如何在C++代码中调用写好的C接口?你可能会奇怪,C++不是兼容C吗?直接调用不就可以了?这里我们先按下不表,先看看C++如何调用C代码接口. C++如何调用C接口 为什么会有这样的情况呢?想象 ...

  9. 调用webservice接口,数据不回滚问题

    调用webservice接口,数据不回滚问题 使用cxf+spring框架开发webservice接口,在开发一个具有保存数据的接口功能时,如果数据发生了异常,对service层无论使用了xml配置声 ...

最新文章

  1. SpringMVC框架
  2. Making Sense of Cryptoeconomics
  3. 转换汉字为unicode形式的字符串和转换unicode形式字符串转换成汉字
  4. SAP Spartacus payment detail page的CMS模型
  5. 服务器缺少storportSYS文件,Windows操作系统蓝屏日志分析方法
  6. linux登录后出现_bash-4.1#终端提示符异常
  7. 【Foreign】字串变化 [DP]
  8. innodb_flush_log_at_trx_commit和sync_binlog参数详解
  9. 用Java打印棱形的思路,java打印菱形思路
  10. 文字转语音真人发声app哪个好用?几个好用的手机文字转语音软件
  11. 前端 DFA 敏感词过滤
  12. 超大文件调用讯飞语音听写解决方案
  13. linux补齐命令,Linux中10个有用的命令行补齐命令
  14. win7如何显示文件后缀名【系统天地】
  15. Numpy中使用astype函数将字符串格式数据转换为数值数据类型
  16. Python Leetcode(507.完美数)
  17. 登录失败、请确认地址和端口
  18. 还不习惯Office 2007
  19. 抖音是如何毁掉我们的!-- “奶嘴娱乐”使然
  20. Turtlebot2简单控制

热门文章

  1. MA5626 MA5620改交换机 二层端口互通命令
  2. Linux运维的必备知识和素质
  3. 高德地图 JS API 结合VUE 展示公交线路示例
  4. Hibernate(1)Hibernate简介和简单示例,了解Hibernate事务回滚用法
  5. 毛新生:云计算的关键是引领和开放
  6. 数据仓库的源数据类型
  7. ramps1.4介绍及4988常见问题总结
  8. flash as3 android air 插入视频,用Flash AS3代码实现多FLV视频播放无缝衔接
  9. spring怎么解耦_Spring的IOC,你真的能解释清楚吗?
  10. STM32串口中断接收HAL库超详解析