Trung Quốc chất lượng tốt IT kỹ thuật trang web
Chuyên nghiệp IT kỹ thuật sáng tác ngôi cao
IT chức nghiệp tại tuyến giáo dục ngôi cao
Camera chụp ảnh giao diện hẳn là như thế nào kéo?
WeChat quét mã chia sẻ
import { common } from '@kit.AbilityKit'; import { camera, cameraPicker } from '@kit.CameraKit'; import { BusinessError } from '@kit.BasicServicesKit'; let context = getContext(this) as common.Context; async function startCameraPicker() { try { let pickerProfile: cameraPicker.PickerProfile = { cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK }; let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(context, [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO], pickerProfile); console.log( "the pick pickerResult is:" + JSON.stringify(pickerResult)); } catch (error) { let err = error as BusinessError; console.error(`the pick call failed. error code: ${err.code}`); } } @Entry @Component struct StartCameraPickerView { build() { Column() { Button( "Điểm đánh kéo camera" ) .onClick(() => startCameraPicker()) } .width( "100%" ) .height( "100%" ) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) } }