27 lines
627 B
Vue
Raw Permalink Normal View History

2024-04-23 18:15:52 +03:00
<template>
2024-04-23 22:17:54 +03:00
<div class="nadar-page">
<div style="text-align: center;">
<van-image :src="src" width="200" height="200" round fit="cover" style="box-shadow: 0 0 12px rgba(0,0,0,0.1)" @click="takePicture" />
</div>
2024-04-23 20:48:21 +03:00
2024-04-23 22:17:54 +03:00
<pre>{{ debug }}</pre>
</div>
2024-04-23 18:15:52 +03:00
</template>
2024-04-23 20:48:21 +03:00
<script setup lang="ts">
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera'
const src = ref()
2024-04-23 22:17:54 +03:00
const debug = ref()
2024-04-23 20:48:21 +03:00
async function takePicture() {
const photo = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
})
2024-04-23 22:17:54 +03:00
2024-04-23 20:48:21 +03:00
debug.value = photo
src.value = photo.webPath
}
</script>