如何在' v-ons-alert-dialog '上触发deviceBackButton



在文档中,deviceBackButton在设备返回按钮上被触发。在我的应用程序中,它不是在设备返回按钮上触发的。设备后退按钮终止我的应用程序,没有显示警告对话框。我不想终止应用。

<template>
<v-ons-alert-dialog
@deviceBackButton="backButtonEvent"
>
...
</v-ons-alert-dialog>
</template>
<script>
export default {
methods: {
backButtonEvent(event) {
alert('hello, world');
return event.preventDefault();
}
}
}
</script>

这是由于Onsen UI的一个bug。

这个bug现在已经修复了,但还没有发布:https://github.com/OnsenUI/OnsenUI/commit/f55de7910

它将包含在Onsen UI的下一个补丁版本中。

所以要回答你的问题,你可以确保deviceBackButton处理程序是通过从master构建Onsen UI并在你的项目中使用它来调用的,或者你可以在它发布时使用下一个版本。

相关内容

  • 没有找到相关文章

最新更新