【问题标题】:BootstrapVue message box input press `Enter` to confirmBootstrapVue 消息框输入按 `Enter` 确认
【发布时间】:2021-03-24 02:23:09
【问题描述】:

Vue:v2.6.12
BootstrapVue:v2.21.2

不用手动点击OK,如何按Enter确认?

let text
this.$bvModal.msgBoxConfirm(<input vModel={text} />)

【问题讨论】:

  • 我使用 Vue 和 Bootstrap,但不使用 BootstrapVue。从概念上讲,如果您可以将事件处理程序绑定到您的 msgBoxConfirm &lt;input&gt;,那么当您收到回车键事件时,调用“确定”按钮事件处理程序。
  • @Tim 是的,但是 afaik,"'OK' 按钮事件处理程序" 没有暴露
  • @Tim 我已经解决了。

标签: javascript vue.js vuejs2 jsx bootstrap-vue


【解决方案1】:

我想通了:

const modalId = 'modalId'

const ok = () => this.$bvModal.hide(modalId)

let text

this.$bvModal.msgBoxConfirm(<input vModel={text} vOn:keyup_enter={ok} />, {
  id: modalId,
})

【讨论】:

    猜你喜欢
    • 2020-06-02
    • 1970-01-01
    • 2017-05-13
    • 1970-01-01
    • 2023-03-26
    • 2021-09-04
    • 2023-04-06
    • 2012-01-13
    • 1970-01-01
    相关资源
    最近更新 更多