Files
SkinCamera/pages/index/index.uvue
T
2026-03-12 13:33:51 +08:00

41 lines
933 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<image class="logo" src="/static/logo.png"></image>
<text class="title">{{title}}</text>
<xf-camera style="height:750rpx; background-color: red;" @error="onError" :flash="flash"
:position="device"></xf-camera>
<image v-if="imagePath" mode="aspectFit" :src="imagePath"></image>
</view>
</template>
<script setup lang="uts">
const title = ref('Hello')
// 相机闪光灯状态('off' | 'on' | 'auto'
const flash = ref('off')
// 相机朝向('front' | 'back'
const device = ref('back')
// 拍摄的图片路径
const imagePath = ref('')
// 相机错误处理
const onError = (e : any) => {
console.log('相机错误:', e)
// 可在此添加用户提示,如 uni.showToast
}
</script>
<style>
.logo {
height: 100px;
width: 100px;
margin: 100px auto 25px auto;
}
.title {
font-size: 18px;
color: #8f8f94;
text-align: center;
}
</style>