中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
arkts怎么打开摄像头拍照界面,拍照后返回图片
微信扫码分享
import abilityAccessCtrl from '@ohos.abilityAccessCtrl' async takePhoto() { await abilityAccessCtrl.createAtManager().requestPermissionsFromUser(getContext(this), ['ohos.permission.CAMERA', 'ohos.permission.READ_MEDIA']) let context = getContext(this) as common.UIAbilityContext let result = await context.startAbilityForResult({ action: "ohos.want.action.imageCapture" }) return result.want.uri // 照片uri }