popViewA.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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':'']">
  9. <block v-for="(item,index) in itemList" :key="index">
  10. <view class="tui-actionsheet-btn tui-actionsheet-divider"
  11. :class="[(!isCancel && index==itemList.length-1)?'tui-btn-last':'']"
  12. hover-class="tui-actionsheet-hover" :hover-stay-time="150" :data-index="index"
  13. :style="{color:item.color || '#1a1a1a'}" @tap="handleClickItem">{{item.text}}</view>
  14. </block>
  15. </view>
  16. <view class="tui-actionsheet-btn tui-actionsheet-cancel" hover-class="tui-actionsheet-hover"
  17. :hover-stay-time="150" v-if="isCancel" @tap="handleClickCancel">{{$t('order.quxiao')}}</view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: "tuiActionsheet",
  24. props: {
  25. //点击遮罩 是否可关闭
  26. maskClosable: {
  27. type: Boolean,
  28. default: true
  29. },
  30. //显示操作菜单
  31. show: {
  32. type: Boolean,
  33. default: false
  34. },
  35. //菜单按钮数组,自定义文本颜色,红色参考色:#e53a37
  36. itemList: {
  37. type: Array,
  38. default: function() {
  39. return [{
  40. text:this.$t('order.queding'),
  41. color: "#1a1a1a"
  42. }]
  43. }
  44. },
  45. //提示文字
  46. tips: {
  47. type: String,
  48. default: ""
  49. },
  50. //提示文字颜色
  51. color: {
  52. type: String,
  53. default: "#9a9a9a"
  54. },
  55. //提示文字大小 rpx
  56. size: {
  57. type: Number,
  58. default: 26
  59. },
  60. //是否需要取消按钮
  61. isCancel: {
  62. type: Boolean,
  63. default: true
  64. }
  65. },
  66. methods: {
  67. handleClickMask() {
  68. if (!this.maskClosable) return;
  69. this.handleClickCancel();
  70. },
  71. handleClickItem(e) {
  72. if (!this.show) return;
  73. const dataset = e.currentTarget.dataset;
  74. this.$emit('Itemclick', dataset.index);
  75. },
  76. handleClickCancel() {
  77. this.$emit('chooseCancel');
  78. }
  79. }
  80. }
  81. </script>
  82. <style>
  83. .tui-actionsheet {
  84. width:750upx;
  85. position: fixed;
  86. left: 0;
  87. right: 0;
  88. bottom: 0;
  89. z-index: 9999;
  90. visibility: hidden;
  91. transform: translate3d(0, 100%, 0);
  92. transform-origin: center;
  93. transition: all 0.3s ease-in-out;
  94. background: #eaeaec;
  95. min-height: 100rpx;
  96. }
  97. .tui-actionsheet-show {
  98. transform: translate3d(0, 0, 0);
  99. visibility: visible;
  100. }
  101. .tui-tips {
  102. width:750upx;
  103. padding: 30rpx 60rpx;
  104. box-sizing: border-box;
  105. text-align: center;
  106. background: #fff;
  107. display: flex;
  108. align-items: center;
  109. justify-content: center;
  110. }
  111. .tui-operate-box {
  112. padding-bottom: 12rpx;
  113. }
  114. .tui-actionsheet-btn {
  115. width:750upx;
  116. height: 100rpx;
  117. background: #fff;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. text-align: center;
  122. font-size: 36rpx;
  123. position: relative;
  124. }
  125. .tui-btn-last {
  126. padding-bottom: env(safe-area-inset-bottom);
  127. }
  128. .tui-actionsheet-divider::before {
  129. content: '';
  130. width:750upx;
  131. border-top: 1rpx solid #d9d9d9;
  132. position: absolute;
  133. top: 0;
  134. left: 0;
  135. -webkit-transform: scaleY(0.5);
  136. transform: scaleY(0.5);
  137. }
  138. .tui-actionsheet-cancel {
  139. color: #1a1a1a;
  140. padding-bottom: env(safe-area-inset-bottom);
  141. }
  142. .tui-actionsheet-hover {
  143. background: #f7f7f9;
  144. }
  145. .tui-actionsheet-mask {
  146. position: fixed;
  147. top: 0;
  148. left: 0;
  149. right: 0;
  150. bottom: 0;
  151. background: rgba(0, 0, 0, 0.6);
  152. z-index: 9996;
  153. transition: all 0.3s ease-in-out;
  154. opacity: 0;
  155. visibility: hidden;
  156. }
  157. .tui-mask-show {
  158. opacity: 1;
  159. visibility: visible;
  160. }
  161. </style>