iview里面的使用draggable拖拽移动,禁止可以点击其他区域

分析:

 

1.iview里面的使用draggable拖拽移动后会让弹层消失,

文档里面:

mask是否显示遮罩层,开启 draggable 时,强制不显示

2.由此看到,iview  开启 draggable 时,弹层强制不显示了,

所以需要设置,不能点击其他区域,尤其是页面的按钮;

解决方法:

iview里面有个默认的属性:

.ivu-modal-no-mask {

    pointer-events: none;

}

改成下面的就可以了:

.ivu-modal-no-mask {

    pointer-events: auto;

}

效果图:

代码如下:

<template>
  <div id="app">
    <Button @click="modal12 = true">Open modal</Button>
    <Button style="margin-left:20px;" @click="test">测试弹层消失后到底能不能点击</Button>
    <Modal v-model="modal12" draggable  title="Modal 1">
        <div>This is the first modal</div>
    </Modal>
  </div>
</template>

<script>
export default {
  name: 'App',
  data(){
    return {
      modal12: false,
    }
  },
  methods: {
    test() {
      console.log(1);
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
  .ivu-modal-no-mask {
    pointer-events: none;
    }
</style>

 

最后为了方便大家的沟通与交流请加QQ群: 625787746

请进QQ群交流:【IT博客技术分享群①】:https://jq.qq.com/?_wv=1027&k=DceI0140

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT博客技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值