popViewGG.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view>
  3. <view class="tui-actionsheet-mask" :class="[show?'tui-mask-show':'']" @tap="handleClickMask"></view>
  4. <view class="tui-actionsheet-class tui-actionsheet" :class="[show?'tui-actionsheet-show':'']">
  5. <view class="tui-tips" :style="{fontSize:size+'rpx',color:color}" v-if="tips">
  6. {{tips}}
  7. </view>
  8. <view :class="[isCancel?'tui-operate-box':'tui-operate-boxN']">
  9. <slot></slot>
  10. </view>
  11. <view v-if="showbotom">
  12. <view class="tui-actionsheet-btn tui-actionsheet-cancel" hover-class="tui-actionsheet-hover"
  13. :hover-stay-time="150" v-if="isCancel" @tap="handleClickCancel(1)">{{acttips}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: "tuiActionsheet",
  21. props: {
  22. //点击遮罩 是否可关闭
  23. maskClosable: {
  24. type: Boolean,
  25. default: true
  26. },
  27. //显示操作菜单
  28. show: {
  29. type: Boolean,
  30. default: false
  31. },
  32. //菜单按钮数组,自定义文本颜色,红色参考色:#e53a37
  33. itemList:{},
  34. //提示文字
  35. tips: {
  36. type: String,
  37. default: ""
  38. },
  39. //提示文字
  40. acttips: {
  41. type: String,
  42. default: "Hoàn thành"
  43. },
  44. //提示文字颜色
  45. color: {
  46. type: String,
  47. default: "#9a9a9a"
  48. },
  49. //提示文字大小 rpx
  50. size: {
  51. type: Number,
  52. default: 26
  53. },
  54. //是否需要取消按钮
  55. isCancel: {
  56. type: Boolean,
  57. default: true
  58. },
  59. //是否需要底部按钮
  60. showbotom: {
  61. type: Boolean,
  62. default: true
  63. },
  64. },
  65. watch: {
  66. show(val){
  67. if(val){
  68. // 背景不可滚动
  69. //document.body.style.overflow='hidden';
  70. }
  71. else{
  72. // 背景可滚动
  73. //document.body.style.overflow='';
  74. }
  75. }
  76. },
  77. methods: {
  78. handleClickMask() {
  79. if (!this.maskClosable) return;
  80. this.handleClickCancel(0);
  81. },
  82. handleClickItem(e) {
  83. if (!this.show) return;
  84. const dataset = e.currentTarget.dataset;
  85. this.$emit('click', {
  86. index: dataset.index
  87. });
  88. },
  89. selectGuige(index,name){
  90. this.$emit('EselectGuige',index,name);
  91. },
  92. handleClickCancel(index) {
  93. this.$emit('chooseCancel',index);
  94. }
  95. }
  96. }
  97. </script>
  98. <style>
  99. .tui-actionsheet {
  100. width:750upx;
  101. position: fixed;
  102. left: 0;
  103. right: 0;
  104. bottom: 0;
  105. z-index: 9999;
  106. visibility: hidden;
  107. transform: translate3d(0, 100%, 0);
  108. transform-origin: center;
  109. transition: all 0.3s ease-in-out;
  110. background: #eaeaec;
  111. min-height: 100rpx;
  112. }
  113. .tui-actionsheet-show {
  114. transform: translate3d(0, 0, 0);
  115. visibility: visible;
  116. }
  117. .tui-tips {
  118. width:750upx;
  119. padding: 30rpx 60rpx;
  120. box-sizing: border-box;
  121. text-align: center;
  122. background: #fff;
  123. display: flex;
  124. align-items: center;
  125. justify-content: center;
  126. }
  127. .tui-operate-box {
  128. padding-bottom: 12rpx;
  129. max-height: 70vh;
  130. overflow: scroll;
  131. }
  132. .tui-operate-boxN {
  133. max-height: 70vh;
  134. overflow: scroll;
  135. }
  136. .tui-actionsheet-btn {
  137. width:750upx;
  138. height: 100rpx;
  139. background: #fff;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. text-align: center;
  144. font-size: 36rpx;
  145. position: relative;
  146. }
  147. .tui-btn-last {
  148. padding-bottom: env(safe-area-inset-bottom);
  149. }
  150. .tui-actionsheet-divider::before {
  151. content: '';
  152. width:750upx;
  153. border-top: 1rpx solid #d9d9d9;
  154. position: absolute;
  155. top: 0;
  156. left: 0;
  157. -webkit-transform: scaleY(0.5);
  158. transform: scaleY(0.5);
  159. }
  160. .tui-actionsheet-cancel {
  161. color: #1a1a1a;
  162. padding-bottom: env(safe-area-inset-bottom);
  163. }
  164. .tui-actionsheet-hover {
  165. background: #f7f7f9;
  166. }
  167. .tui-actionsheet-mask {
  168. position: fixed;
  169. top: 0;
  170. left: 0;
  171. right: 0;
  172. bottom: 0;
  173. background: rgba(0, 0, 0, 0.6);
  174. z-index: 9996;
  175. transition: all 0.3s ease-in-out;
  176. opacity: 0;
  177. visibility: hidden;
  178. }
  179. .tui-mask-show {
  180. opacity: 1;
  181. visibility: visible;
  182. }
  183. .skuViewCt{
  184. display: flex;
  185. flex-direction: column;
  186. justify-content:center;
  187. width: 100%;
  188. margin-top: 10rpx;
  189. }
  190. .contensbgg{
  191. display: flex;
  192. flex-wrap: wrap;
  193. justify-content:flex-start;
  194. align-items:center;
  195. }
  196. .guigeleixing{
  197. font-size: 26rpx;
  198. line-height: 40rpx;
  199. height: 40rpx;
  200. color: black;
  201. font-weight: bold;
  202. }
  203. .youhuixinxi{
  204. margin: 8rpx;
  205. padding: 4rpx;
  206. font-size: 26rpx;
  207. line-height: 54rpx;
  208. height: 54rpx;
  209. border: 2rpx solid lightgray;
  210. border-radius: 8rpx;
  211. }
  212. .xz{
  213. background-color: #ff0000;
  214. }
  215. </style>