tools-bar.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div class="bars-container toLeft" :style="{ top: `calc(10% + ${offsetY}px)`,
  3. right:` calc(24% + ${offsetX}px)`}">
  4. <div @click="isOpen=!isOpen" class=" button-close center" draggable="false">
  5. <div :key="item" v-for="item of 3" class="point" ></div>
  6. </div>
  7. <div class="contain-main" style="width: 100%;" :style="{height: isOpen? '460px':'0px'}">
  8. <div :key="item" v-for="item of option" @click="item.event" class="click" style="width: 100%;height: 70px;" :style="{background: `url(${item.icon}) no-repeat center/50%`}"></div>
  9. </div>
  10. <div @click="isOpen=!isOpen" style="width: 100%;height: 20px;background: rgba(0,0,0,0.5)" class="center"> <div class="arrow full"
  11. :style="{transform: `rotate(${isOpen? 0:180}deg)`}"
  12. ></div> </div>
  13. </div>
  14. </template>
  15. <script>
  16. import {fullscreenToggel} from "../../../util/util";
  17. export default {
  18. name: "tools-bar",
  19. inject: [ 'index'],
  20. props: {
  21. option: {
  22. type: 'Array',
  23. default: []
  24. }
  25. },
  26. mounted() {
  27. },
  28. data(){
  29. return{
  30. isOpen: true,
  31. offsetX: 0,
  32. offsetY: 0,
  33. }
  34. },
  35. methods: {
  36. ondrop(e){
  37. // this.offsetX = e.offsetX;
  38. // this.offsetY = e.offsetY;
  39. // console.log(this.offsetX,this.offsetY)
  40. },
  41. }
  42. }
  43. </script>
  44. <style scoped>
  45. .bars-container{
  46. user-select: none;
  47. width: 70px;
  48. height: auto;
  49. position: absolute;
  50. background: rgba(0,0,0,0.5);
  51. box-shadow: 2px 2px 2px #131313;
  52. z-index: 999;
  53. }
  54. .button-close{
  55. cursor: pointer;
  56. width: 100%;
  57. height: 20px;
  58. background: rgba(0,0,0,0.5);
  59. }
  60. .point{
  61. width: 10px;
  62. height: 10px;
  63. margin-left: 5px;
  64. background: white;
  65. box-shadow: 2px 2px 2px #393939;
  66. border-radius: 50%;
  67. }
  68. .arrow{
  69. cursor: pointer;
  70. background: url("/img/arrow-up.png") no-repeat center/contain;
  71. /*transform: rotate(180deg);*/
  72. transition: transform 1s;
  73. }
  74. .click{
  75. cursor: pointer;
  76. }
  77. .click:hover{
  78. transform: translate(1px,1px);
  79. }
  80. .contain-main{
  81. transition: height 1s;
  82. overflow: hidden;
  83. }
  84. </style>