# 蒙层(Overlay)

用于弹窗出现时,遮罩底部文字,避免干扰

蒙层样式

遮罩黑色 #0C0C0C 75%

# 示例

<template>
  <div class="wrapper">
    <dof-minibar title="7.1蒙层"></dof-minibar>
    <div class="btn-box">
      <dof-button text="点击打开蒙层" @dofButtonClicked="openOverlay"></dof-button>
    </div>
    <dof-overlay :show="show" @dofOverlayBodyClicked="dofOverlayBodyClicked"></dof-overlay>
  </div>
</template>

<style scoped>
.wrapper {
  background-color: #f9f9f9;
}
.m-t-16 {
  margin-top: 16px;
}
.title-box {
  padding: 32px;
  background-color: #e5e5e8;
}
.title-text {
  font-family: PingFangSC-Medium;
  font-size: 36px;
  color: #000000;
  font-weight: 500;
}
.btn-box {
  flex-direction: row;
  justify-content: center;
  margin-top: 120px;
}

@media screen and (weex-theme: colmo) {
  .wrapper {
    background-color: #151617;
  }
}
</style>

<script>
import { DofMinibar, DofOverlay, DofButton } from 'dolphin-weex-ui'
export default {
  components: { DofMinibar, DofOverlay, DofButton },
  data: () => ({
    show: false
  }),
  computed: {},
  created() {},
  methods: {
    openOverlay() {
      this.show = true
    },
    dofOverlayBodyClicked() {
      this.show = false
    }
  }
}
</script>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

# Attributes

Prop Type Required Default Description
show Boolean Y false 是否显示overlay蒙层
opacity Number N 0.3 蒙层opacity度数0-1, Ps:底色为rgb(0,0,0)
has-animation Boolean N true 是否开启蒙层出现动画
duration Number 300 N 蒙层动画时间
timing-function Array N ['ease-in','ease-out'] 蒙层显示和隐藏动画函数

# Events

事件名 说明 回调参数
dofOverlayBodyClicked 消失后 -
dofOverlayBodyClicking 点击立即 -
点我扫二维码 查看demo
Last Updated: 1/4/2024, 4:01:09 PM