Giter Site home page Giter Site logo

使用的是this.$viewerApi方法,我希望点击modal或者关闭按钮关闭viewer时,阻止点击事件冒泡,要怎么做? about v-viewer HOT 4 CLOSED

kang-int avatar kang-int commented on July 18, 2024
使用的是this.$viewerApi方法,我希望点击modal或者关闭按钮关闭viewer时,阻止点击事件冒泡,要怎么做?

from v-viewer.

Comments (4)

mirari avatar mirari commented on July 18, 2024

https://codepen.io/mirari/pen/abXYxeZ

在hide回调或事件监听中拦截事件

from v-viewer.

kang-int avatar kang-int commented on July 18, 2024

https://codepen.io/mirari/pen/abXYxeZ

在hide回调或事件监听中拦截事件

我在这个链接中试了,使用e.stopPropagation()后,并没有拦截click事件。
我遇到的具体问题是:在el-popover弹出框中点击按钮,预览图片,当关闭预览时,由于body被点击了,popper被关闭了。我希望回到popper界面,而不是关闭预览同时把popper也关闭了

from v-viewer.

mirari avatar mirari commented on July 18, 2024

例子里拦截的是viewer自己的关闭事件
popper被关闭是因为elementui的popper组件自己监听了元素外的点击事件,严格来说viewer没有义务去解决这个问题。
你需要手动获取到viewer弹窗后在body下创建的dom对象并监听click事件来阻止冒泡。可以在弹窗回调中查找.viewer-container元素

from v-viewer.

kang-int avatar kang-int commented on July 18, 2024

例子里拦截的是viewer自己的关闭事件 popper被关闭是因为elementui的popper组件自己监听了元素外的点击事件,严格来说viewer没有义务去解决这个问题。 你需要手动获取到viewer弹窗后在body下创建的dom对象并监听click事件来阻止冒泡。可以在弹窗回调中查找.viewer-container元素

好的,谢谢了

from v-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.