| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <template>
- <view>
- <view class="tui-actionsheet-mask" :class="[show?'tui-mask-show':'']" @tap="handleClickMask"></view>
- <view class="tui-actionsheet-class tui-actionsheet" :class="[show?'tui-actionsheet-show':'']">
- <view class="tui-tips" :style="{fontSize:size+'rpx',color:color}" v-if="tips">
- {{tips}}
- </view>
- <view :class="[isCancel?'tui-operate-box':'tui-operate-boxN']">
- <slot></slot>
- </view>
- <view v-if="showbotom">
- <view class="tui-actionsheet-btn tui-actionsheet-cancel" hover-class="tui-actionsheet-hover"
- :hover-stay-time="150" v-if="isCancel" @tap="handleClickCancel">{{acttips}}</view>
- </view>
-
- </view>
- </view>
- </template>
-
- <script>
- export default {
- name: "tuiActionsheet",
- props: {
- //点击遮罩 是否可关闭
- maskClosable: {
- type: Boolean,
- default: true
- },
- //显示操作菜单
- show: {
- type: Boolean,
- default: false
- },
- //菜单按钮数组,自定义文本颜色,红色参考色:#e53a37
- itemList:{},
- //提示文字
- tips: {
- type: String,
- default: ""
- },
- //提示文字
- acttips: {
- type: String,
- default: "完成"
- },
- //提示文字颜色
- color: {
- type: String,
- default: "#9a9a9a"
- },
- //提示文字大小 rpx
- size: {
- type: Number,
- default: 26
- },
- //是否需要取消按钮
- isCancel: {
- type: Boolean,
- default: true
- },
- //是否需要底部按钮
- showbotom: {
- type: Boolean,
- default: true
- },
-
- },
- watch: {
- show(val){
- if(val){
- // 背景不可滚动
- //document.body.style.overflow='hidden';
- }
- else{
- // 背景可滚动
- //document.body.style.overflow='';
- }
- }
- },
- methods: {
- handleClickMask() {
- if (!this.maskClosable) return;
- this.handleClickCancel();
- },
- handleClickItem(e) {
- if (!this.show) return;
- const dataset = e.currentTarget.dataset;
- this.$emit('click', {
- index: dataset.index
- });
- },
-
- selectGuige(index,name){
- this.$emit('EselectGuige',index,name);
- },
-
- handleClickCancel() {
- this.$emit('chooseCancel');
- }
- }
- }
- </script>
-
- <style>
- .tui-actionsheet {
- width:750upx;
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 9999;
- visibility: hidden;
- transform: translate3d(0, 100%, 0);
- transform-origin: center;
- transition: all 0.3s ease-in-out;
- background: #eaeaec;
- min-height: 100rpx;
- }
-
- .tui-actionsheet-show {
- transform: translate3d(0, 0, 0);
- visibility: visible;
- }
-
- .tui-tips {
- width:750upx;
- padding: 30rpx 60rpx;
- box-sizing: border-box;
- text-align: center;
- background: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .tui-operate-box {
- padding-bottom: 12rpx;
- max-height: 70vh;
- overflow: scroll;
- }
- .tui-operate-boxN {
- max-height: 70vh;
- overflow: scroll;
- }
-
- .tui-actionsheet-btn {
- width:750upx;
- height: 100rpx;
- background: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- font-size: 36rpx;
- position: relative;
- }
-
- .tui-btn-last {
- padding-bottom: env(safe-area-inset-bottom);
- }
-
- .tui-actionsheet-divider::before {
- content: '';
- width:750upx;
- border-top: 1rpx solid #d9d9d9;
- position: absolute;
- top: 0;
- left: 0;
- -webkit-transform: scaleY(0.5);
- transform: scaleY(0.5);
- }
-
- .tui-actionsheet-cancel {
- color: #1a1a1a;
- padding-bottom: env(safe-area-inset-bottom);
- }
-
- .tui-actionsheet-hover {
- background: #f7f7f9;
- }
-
- .tui-actionsheet-mask {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.6);
- z-index: 9996;
- transition: all 0.3s ease-in-out;
- opacity: 0;
- visibility: hidden;
- }
-
- .tui-mask-show {
- opacity: 1;
- visibility: visible;
- }
-
- .skuViewCt{
- display: flex;
- flex-direction: column;
- justify-content:center;
- width: 100%;
- margin-top: 10rpx;
- }
-
- .contensbgg{
- display: flex;
- flex-wrap: wrap;
- justify-content:flex-start;
- align-items:center;
- }
-
- .guigeleixing{
- font-size: 26rpx;
- line-height: 40rpx;
- height: 40rpx;
- color: black;
- font-weight: bold;
- }
- .youhuixinxi{
- margin: 8rpx;
- padding: 4rpx;
- font-size: 26rpx;
- line-height: 54rpx;
- height: 54rpx;
- border: 2rpx solid lightgray;
- border-radius: 8rpx;
- }
- .xz{
- background-color: #ff0000;
- }
-
- </style>
|