<view
style="overflow: hidden; position: fixed; left: {{camera.left}}rpx; top: {{camera.top}}rpx; width: {{camera.width}}rpx; height: {{camera.height}}rpx;">
<camera id="myCamera" mode="normal" resolution="{{camera.resolution}}" device-position="{{camera.devicePosition}}"
flash="{{camera.devicePosition=='back'?camera.flash.back:camera.flash.front}}"
frame-size="camera.frameSize"
style="{{css.frostedGlass}} position: relative; left: 0rpx; top: 0rpx; width: 100%; height: 100%;"
binderror="onCameraError" bindinitdone="onCameraInitdone" hidden="{{camera.hidden}}"></camera>
</view>
<movable-area
style="pointer-events: none; position: fixed; left: {{camera.left}}rpx; top: {{camera.top}}rpx; width: {{camera.width}}rpx; height: {{camera.height}}rpx;"
scale-area="{{ma.scaleArea}}">
<movable-view
style="pointer-events: auto; width: {{mv.width}}rpx; height: {{mv.height}}rpx; padding-left: {{template.padding.left}}rpx; padding-top: {{template.padding.top}}rpx; padding-right: {{template.padding.right}}rpx; padding-bottom: {{template.padding.bottom}}rpx;"
direction="{{mv.direction}}" inertia="{{mv.inertia}}" out-of-bounds="{{mv.outOfBounds}}" x="{{mv.x}}rpx"
y="{{mv.y}}rpx" damping="{{mv.damping}}" friction="{{mv.friction}}" disabled="{{mv.disabled}}" scale="{{mv.scale}}"
scale-min="{{mv.scaleMin}}" scale-max="{{mv.scaleMax}}" scale-value="{{mv.scaleValue}}" animation="{{mv.animation}}"
bindchange="onMovableViewChange" bindscale="onMovableViewScale">
<image id="myWater" src="{{watermark.image}}"
style="width: {{watermark.width}}rpx; height: {{watermark.height}}rpx; transform: translate({{watermark.offsetX}}rpx, {{watermark.offsetY}}rpx) rotate({{rotateValue}}deg); -webkit-transform: translate({{watermark.offsetX}}rpx, {{watermark.offsetY}}rpx) rotate({{rotateValue}}deg);" />
</movable-view>
</movable-area>
<view class="bottom-bar" style="bottom: {{bottomBar.bottom}}rpx;">
<view class="bottom-bar-unit">
<image id="btnTakePhoto" class="bottom-bar-item" src="../../images/camera_takephoto_{{camera.takePhotoImage}}.png"
style="transform: rotate({{rotateValue}}deg); -webkit-transform: rotate({{rotateValue}}deg);" bindtap="takePhoto"
bindtouchstart="onTouchstart" bindtouchend="onTouchend" bindtouchcancel="onTouchend" />
</view>
</view>
如代码,使用原生组件camera和普通组件,安卓下正常显示,按代码顺序,相机组件是在后面。但在IOS里,相机组件显示在最前边了。不是说都已经同层渲染了吗?为什么在IOS中不管用?
camera组件设置了hidden属性,本意是加载页面以后延时200毫秒再显示相机,这样保证了动画顺滑。但是刚才看到
https://developers.weixin.qq.com/community/develop/doc/00088a50584128c60bfa3fdde5b409?jumpto=comment&commentid=000c62241fccb83d951b1b8ee5d8
已知问题:camera组件设置hidden偶现同层失败
规避方案:不设置hidden,使用定位规避,不显示的时候在不可见区域,显示的时候再挪过来。
唉!先这样吧!