关于uni-app:unipopup样式及遮罩

6次阅读

共计 894 个字符,预计需要花费 3 分钟才能阅读完成。

/ 小声 BB/ :
最近开始写 uni-app,发现 ui 框架是真的很 … 难用。官网文档也 … 一言难尽。或者某种意义上来讲,这也属于是由奢入俭难吧。同样的,存在也即是正当,我没有不感恩的意思。

效果图:

template:

<template>
  <view>
    <view class="mark" v-show="showMask"></view>
    <!-- 其余组件代码略 -->
    <uni-popup ref="delete" type="dialog" class="popup-style">
      <uni-popup-dialog type="error" cancelText="勾销" confirmText="确认" title="删除" content="是否确认删除" @confirm="deleteConfirm" @close="showMask=false"></uni-popup-dialog>
    </uni-popup>
  </view>
</template>

script:

import uniPopup from "@/components/uni-popup/uni-popup"
import uniPopupDialog from "@/components/uni-popup-dialog/uni-popup-dialog"

export default {components:{ uniPopup, uniPopupDialog},
 data() {
   return {showMask: false,}
  },
 <!-- 其余代码略 -->
},

scss:

<style lang="scss" scoped>
  // uni-popup 款式重置
  /deep/.popup-style {
  .uni-popup-dialog {
    position: fixed;
    top: 30%;
    left: calc((100vw - 300px)/2);
  }
  // 遮罩层
  .mark {
    height: 100vh; 
    width: 100vw; 
    background: rgba(0, 0, 0, 0.5); 
    position: absolute;
    left: 0%;
    right: 0%;
    z-index: 1;
  }
}
</style>
正文完
 0