dragResize.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <div class="vdr" :style="style" :class="active ? 'active' : 'inactive'" @mousedown="bodyDown($event)" @touchstart="bodyDown($event)">
  2. <slot></slot>
  3. <div class="move-stick" v-if="pos == 'absolute'"><i class="iconfont iconyidong"></i></div>
  4. <div
  5. v-for="stick in sticks"
  6. class="vdr-stick"
  7. :class="['vdr-stick-' + stick]"
  8. :style="vdrStick(stick)"
  9. @mousedown.stop.prevent="stickDown(stick, $event)"
  10. @touchstart.stop.prevent="stickDown(stick, $event)"
  11. >
  12. <i class="iconfont" :class="stick=='bl'?'iconfangdar':'iconfangdal'"></i>
  13. </div>
  14. <div class="set-icon" @click="showSettingPanel = true">
  15. <i class="iconfont icon-leixing"></i>
  16. </div>
  17. <Modal class="set-modal" v-model="showSettingPanel" title="设置定位" width="260" :draggable="true" :scrollable="true">
  18. <div class="set-position">
  19. <label>定位:</label>
  20. <select v-model="position">
  21. <option :value="'relative'">相对</option>
  22. <option :value="'absolute'">绝对</option>
  23. </select>
  24. </div>
  25. <div class="set-position" v-if="position == 'relative'">
  26. <span>
  27. <label>大小:</label>
  28. <select v-model="heightAuto">
  29. <option :value="true">内容</option>
  30. <option :value="false">边框</option>
  31. </select>
  32. </span>
  33. <br />
  34. <br />
  35. <span v-if="heightAuto == false">
  36. <label>边框宽度:</label>
  37. <select v-model="widthType" @change="changeWidth">
  38. <option :value="'num'">数值</option>
  39. <option :value="'percent'">百分比</option>
  40. </select>
  41. <input type="number" v-if="widthType == 'num'" v-model="rawWidth" /><label v-if="widthType == 'num'">PX</label>
  42. <input type="number" v-if="widthType == 'percent'" v-model="perWidth" min="0" max="100" /><label v-if="widthType == 'percent'"
  43. >%</label
  44. >
  45. </span>
  46. <span v-if="heightAuto == false">
  47. <label>边框高度:</label>
  48. <input type="number" v-model="rawHeight" /><label>PX</label>
  49. <br />
  50. <br />
  51. </span>
  52. <span>
  53. <label>上边距:</label>
  54. <input type="number" v-model="marginTop" /><label>PX</label>
  55. </span>
  56. <br />
  57. <br />
  58. <span>
  59. <label>下边距:</label>
  60. <input type="number" v-model="marginBottom" /><label>PX</label>
  61. </span>
  62. <br />
  63. <br />
  64. <span>
  65. <label>左边距:</label>
  66. <input type="number" v-model="marginLeft" /><label>PX</label>
  67. </span>
  68. <br />
  69. <br />
  70. <span>
  71. <label>右边距:</label>
  72. <input type="number" v-model="marginRight" /><label>PX</label>
  73. </span>
  74. <br />
  75. <br />
  76. <label>层级:</label>
  77. <span>
  78. <input type="number" v-model="zIndex" />
  79. </span>
  80. <i class="iconfont iconsaoba" @click="deleteElement"></i>
  81. </div>
  82. <div class="set-position" v-if="position == 'absolute'">
  83. <label>水平:</label>
  84. <select v-model="positionType" @change="changePositionType">
  85. <option :value="'left'">左距离</option>
  86. <option :value="'middle'">居中</option>
  87. <option :value="'right'">右距离</option>
  88. </select>
  89. <span v-if="positionType == 'left'"> <input type="number" v-model="rawLeft" disabled /><label>PX</label> </span>
  90. <span v-if="positionType == 'middle'"></span>
  91. <span v-if="positionType == 'right'"> <input type="number" v-model="rawRight" disabled /><label>PX</label> </span>
  92. <br />
  93. <br />
  94. <label>垂直:</label>
  95. <!-- <select v-model="verPosType" disabled>
  96. <option :value="'top'">顶部</option>
  97. </select> -->
  98. <p>顶部</p>
  99. <span v-if="verPosType == 'top'"> <input type="number" v-model="rawTop" disabled /><label>PX</label> </span>
  100. <br />
  101. <br />
  102. <label>宽度:</label>
  103. <select v-model="widthType" @change="changeWidth">
  104. <option :value="'num'">数值</option>
  105. <option :value="'percent'">百分比</option>
  106. </select>
  107. <span v-if="widthType == 'num'"> <input type="number" v-model="rawWidth" disabled /><label>PX</label> </span>
  108. <span v-if="widthType == 'percent'"> <input type="number" v-model="perWidth" min="0" max="100" /><label>%</label> </span>
  109. <br />
  110. <br />
  111. <label>层级:</label>
  112. <span><input type="number" v-model="zIndex"/></span>
  113. <i class="iconfont iconshanchu" @click="deleteElement"></i>
  114. </div>
  115. <div class="set-position">
  116. <button @click="copy">复制</button>
  117. <button @click="paste">粘贴</button>
  118. </div>
  119. <div slot="footer" style="height: 20px"></div>
  120. </Modal>
  121. </div>