日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

uniapp 調用拍照組件

作者:maoge_666 更新時間: 2023-07-16 編程語言

在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述

代碼示例:

<template>
	<view>
        <camera device-position="back" flash="off" @error="error" style="width: 100%; height: 300px;"></camera>
        <button type="primary" @click="takePhoto">拍照</button>
        <view>預覽</view>
        <image mode="widthFix" :src="src"></image>
    </view>
</template>

export default {
    data() {
        return {
            src:""
        }
    },
    methods: {
         takePhoto() {
            const ctx = uni.createCameraContext();
            ctx.takePhoto({
                quality: 'high',
                success: (res) => {
                    this.src = res.tempImagePath
                }
            });
        },
        error(e) {
            console.log(e.detail);
        }
    }
}


原文鏈接:https://blog.csdn.net/maoge_666/article/details/131081194

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新