封装dialog弹窗

封装

<template>
  <!-- 遮罩层 -->
  <div
    v-if="isShowPop"
    class="pop_box"
  >
	<!-- 内容 -->
    <div class="pop_content">
      <div class="content_box">
        <div class="content">
          <div v-html="popInfo" />
        </div>
        <div
          class="btn"
          @click="closePopup"
        >确认</div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  props: {
    isShowPop: {
      type: Boolean,
      default: false
    },
    dataInfo: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
    }
  },
  computed: {
    isShow() {
      return this.isShowPop
    },
    popInfo() {
      return this.dataInfo
    }
  },
  methods: {
    closePopup() {
      this.$emit('close')
    }
  }
}
</script>
<style lang="less" scoped>
  .pop_box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .6);
    z-index: 10000;
    .pop_content {
      height: 100%;
      width: 100%;
      display: flex;
      z-index: 10001;
      justify-content: center;
      align-items: center;
      .content_box {
        width: 265px;
        background: #FFFFFF;
        border-radius: 10px;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #303133;
        .content {
          padding: 30px 20px 0 20px;
          line-height: 22px;
        }
      }
      .btn {
        margin-top: 19px;
        height: 48px;
        line-height: 48px;
        font-family: PingFangSC-Medium;
        font-size: 16px;
        color: #71A8FF;
        text-align: center;
        font-weight: 500;
        border-top: 0.5px solid rgba(237,237,237,1);
        border-radius: 0 0 10px 10px;
      }
    }
  }
</style>

使用

<template>
  <div>
	<div @click="showPop">打开弹窗</div>
    <confirm-pop
	  v-if="isShowPop"
	  :dataInfo="KTBInfo"
	  :is-show-pop="isShowPop"
	  @close="closePop"
	/>
  </div>
  
</template>

import confirmPop from '@/components/confirm-pop/confirmPop.vue'

export default {
  components: {
    confirmPop
  },
  data() {
    return {
      KTBInfo: '',
      isShowPop: false
    }
  },
  methods: {
  	showPop() {
      this.isShowPop = true
    },
  	closePop() {
      this.isShowPop = false
    }
  }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值