Layout.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!-- 公共布局组件 -->
  2. <template>
  3. <view class="custom-camera">
  4. <view class="camera-wrap" :style="{height:cameraHeight+'px'}">
  5. <slot></slot>
  6. </view>
  7. <view class="camera-options flex" >
  8. <view class="camera-options-left camera-item" >
  9. <image src="/static/images/back.png" mode="scaleToFill" @click="handleClikFn('back')"></image>
  10. </view>
  11. <view class="camera-options-center camera-item">
  12. <image src="/static/images/shutter.png" mode="" @click="handleClikFn('shutter')" ></image>
  13. </view>
  14. <!-- <view class="camera-options-ritht camera-item" @click="handleClikFn('reversal')">
  15. <image src="/static/images/reversal.png" mode="scaleToFill"></image>
  16. </view> -->
  17. <view class="camera-options-ritht camera-item">
  18. <image src="/static/images/album.png" mode="" @click="handleClikFn('album')" ></image>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. // 提供一个相机的插槽位置
  25. // 底部可以自定义最右侧按钮(相册/反转)
  26. export default {
  27. data() {
  28. return {
  29. cameraHeight: '', //相机画面宽度
  30. optionsHeight: '', //操作区域
  31. }
  32. },
  33. methods: {
  34. handleClikFn(instruct) {
  35. this.$emit('instruct', instruct)
  36. }
  37. },
  38. mounted() {
  39. this.cameraHeight = uni.getSystemInfoSync().screenHeight * 0.8
  40. this.optionsHeight = uni.getSystemInfoSync().screenHeight * 0.2
  41. console.log(this.optionsHeight)
  42. },
  43. }
  44. </script>
  45. <style lang="scss">
  46. .custom-camera {
  47. height: 100vh;
  48. background-color: #000;
  49. .camera-wrap {
  50. // background-color: #f90;
  51. }
  52. .camera-options {
  53. position: fixed;
  54. height: 200rpx;
  55. width: 750rpx;
  56. bottom: 0;
  57. background-color: #000;
  58. justify-content: space-evenly;
  59. align-items: center;
  60. .camera-item {
  61. flex-direction: row;
  62. justify-content: center;
  63. align-items: center;
  64. // flex: 1;
  65. image {
  66. width: 80rpx;
  67. height: 80rpx;
  68. }
  69. }
  70. .camera-options-center {
  71. image {
  72. width: 120rpx;
  73. height: 120rpx;
  74. }
  75. }
  76. }
  77. }
  78. </style>