Blame view

src/views/components/comMsg.vue 1.85 KB
田浩浩 committed
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
<template>
  <div class="model">
    <div class="mask">123</div>
    <div class="model-dialog">
      <div class="model-header">
        <span>提示</span>
        <a href="javascript:;" class="icon-close"></a>
      </div>
      <div class="model-body">
        <div class="body">这是条消息</div>
      </div>
      <div class="model-footer">
        <button class="btn">确认</button>
      </div>
    </div>
  </div>
</template>


<style scoped lang='scss'>
//css部分
.mask {
  position: fixed; //这里用固定定位,后面设置动画时才不受影响
  top: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(167, 165, 165, 0.486);
  opacity: 0.5;
  z-index: 9;
}
.model-dialog {
  position: absolute;
  //让弹框居中显示
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: 12px;
  width: 600px;
  height: 300px;
  border: 1px solid #f5f5f5;
  overflow: hidden;
  z-index: 10; //这里注意层级要比mask大,覆盖它
}
.model-header {
  position: relative;
  height: 50px;
  padding-left: 10px;
  padding-top: 10px;
  font-size: 20px;
  line-height: 50px;
  background-color: #f5f5f5;
  border-bottom: 1px solid rgb(177, 176, 176);
}
.model-body {
  height: 150px;
  line-height: 150px;
  font-size: 28px;
  text-align: center;
  background-color: #fff;
}
.model-footer {
  background-color: #f5f5f5;
  height: 100px;
  text-align: center;
  line-height: 100px;
}
.btn {
  width: 180px;
  height: 40px;
  border-radius: 8px;
  background-color: rgb(180, 103, 103);
  color: #fff;
  font-size: 18px;
  border: none;
}
.icon-close {
  position: absolute; //如果不加绝对布局,图表显示不出来
  background-color: pink;
  right: 15px;
  top: 16px;
  width: 30px;
  height: 30px;
  z-index: 10;
  //background: url("../assets/icon-close.png") no-repeat;
  background-size: contain;
}
</style>