a-popover的使用

a-popover的使用

<template>
  <div id="popoverUsing">

    <a-popover
      autoAdjustOverflow
      overlayClassName="myPopClass"
      v-model="visible"
      trigger="click"
      placement="bottomLeft"
      @visibleChange="afterCloseDo"
    >

      <!-- 触发popover的元素 -->
      <div class="openPop"></div>

      <!-- 弹框内容区域 -->
      <template slot="content">
        <section>
          <p>Content</p>
          <p>Content</p>
        </section>
        <div>
          <a-button type="primary" style="margin-right:10px" @click="sure"
            >确然</a-button
          >
          <a-button type="primary" @click="cancel">取消</a-button>
        </div>
      </template>

    </a-popover>

  </div>
</template>

<script>

export default {

  data() {
    return {
      visible: false
    }
  },

  methods: {
    sure() {
      console.log('确认')
      this.visible = false
    },

    cancel() {
      console.log('取消')
      this.visible = false
    },

    afterCloseDo() {
      console.log('隐藏后的回调')
    }
  }
}

</script>
<style lang="less" scoped>
.openPop {
  width: 160px;
  height: 24px;
  border: 1px solid green;
}
</style>

<style lang="less">
#popoverUsing{
 .myPopClass {
   width: 200px;
   padding-top: 2px;
   .ant-popover-arrow {
     display: none !important;
   }
   .ant-popover-inner-content {
     section {
       background-color: #ccc;
     }
   }
 }
}
</style>

overlayClassName:普通的class起名对他没有用,需要使用overlayClassName来给他添加类名

加了scoped对他的样式做修改也没有用,修改的使用需要注意,不要造成全局样式污染

参数作用类型默认值
arrowPointAtCenter箭头是否对准目标元素中心布尔值false
autoAdjustOverflow气泡被遮挡时自动调整位置布尔值true
defaultVisible默认是否显隐布尔值false
placement气泡框位置可选,方位词top
visible(v-model)控制显示与隐藏布尔值false
title可以直接在a-popover中,也可以在slot="title"中可选,字符串
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值