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

效果图:

image.png

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>

Adele0
44 声望3 粉丝