微信小程序调取相机实现拍照/录屏(带demo) 您所在的位置:网站首页 小程序使用相机 微信小程序调取相机实现拍照/录屏(带demo)

微信小程序调取相机实现拍照/录屏(带demo)

2024-07-08 19:13| 来源: 网络整理| 查看: 265

我已上传demo案例,有需要的童鞋自行下载,项目直接用微信开发者工具打开,主要修改成自己的appid;运行需要编译到pages/ar/scene-ar-germanBusiness1/index 页面后手机预览打开。可能刚打开是白屏,需要等一会,模型加载需要时间。 在这里插入图片描述

1.效果 在这里插入图片描述

2.创建子组件 在这里插入图片描述 index.wxml代码

index.js代码

const STATE = { NONE: -1, MOVE: 0, ZOOM_OR_PAN: 1 } Component({ behaviors: [require('../../common/share-behavior').default], properties: { isTouchstart: { type: Boolean // 判断是否需要关闭子组件的触碰事件 }, a: { type: Number } }, markerGlb: { type: String }, position: { type: Object }, rotation: { type: Object }, scale: { type: Object }, data: { grandeShow: true, //默认引导图标显示 loaded: false, arReady: false, placedFlag: true, //是否允许模型再次移动识别展示在地平线 }, lifetimes: { async attached() { console.log('data', this.data) } }, methods: { handleReady({ detail }) { const xrScene = this.scene = detail.value; // 显示加载中提示 wx.showLoading({ title: '加载中', mask: true // 是否显示透明蒙层,防止用户点击其他区域 }) console.log('xr-scene', xrScene); }, handleAssetsProgress: function ({ detail }) { console.log('assets progress', detail.value); }, handleAssetsLoaded: function ({ detail }) { console.log('assets loaded', detail.value); // 隐藏加载中提示 wx.hideLoading() this.setData({ loaded: true }); }, handleARReady: function ({ detail }) { console.log('ar-ready', this.scene.ar.arModes, this.scene.ar.arVersion); }, handleARError: function ({ detail }) { console.log('ar-error', detail); }, handleLog: function ({ detail }) { const { el, value } = detail; console.log('log', detail.value); }, } })``` index.json代码 ```html { "component": true, "usingComponents": {}, "renderer": "xr-frame" }

3.创建页面 在这里插入图片描述 在这里插入图片描述 index.wxml代码



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有