Giter Site home page Giter Site logo

Comments (7)

zuihou avatar zuihou commented on June 2, 2024

比如,我在检测到弹窗的表单数据发生修改时, 用户按下esc键,阻止用户关闭弹窗。

from naive-ui.

jahnli avatar jahnli commented on June 2, 2024

close-on-esc

https://www.naiveui.com/zh-CN/os-theme/components/modal#controlled.vue
https://www.naiveui.com/zh-CN/os-theme/components/dialog#async.vue

from naive-ui.

zuihou avatar zuihou commented on June 2, 2024

close-on-esc 属性只是禁止用户点击 esc 时,关闭弹窗。

需求是:

  1. close-on-esc 设置为true,允许用户使用esc关闭弹窗, 但程序检测到表单改动时,可以通过on-esc 或者其他事件阻止框架关闭弹窗
  2. closable 设置为true,允许用户点击右上角关闭按钮关闭弹窗, 但程序检测到表单改动时,可以通过 某个事件阻止框架关闭弹窗

上面需求中: 程序检测到表单改动时,可以交给业务框架自己判断, 但上述中的加粗字体有没有办法能实现?

from naive-ui.

jahnli avatar jahnli commented on June 2, 2024

通过自定义 close-on-esc closable 实现业务逻辑

检测表单改动修改对应的值

from naive-ui.

jahnli avatar jahnli commented on June 2, 2024

image

from naive-ui.

zuihou avatar zuihou commented on June 2, 2024
image 另外,drawer组件的 to 属性, 有什么讲究没? 是否支持父级容器? 目前发现 父子级太深时,就会失效

比如:

<div id="div1">
<div  >
<div  >
<div  >
<n-button @click="xxx" />
<n-drawer to='#div1' v-model:show="xxxxxx" />
</div>
</div>
</div>
</div>

from naive-ui.

jahnli avatar jahnli commented on June 2, 2024

我没具体看,看样子是 Teleport

from naive-ui.

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.