fix(modules/web): use native confirm
This commit is contained in:
@@ -545,9 +545,8 @@ onUnmounted(() => {
|
|||||||
scrollObserver = null;
|
scrollObserver = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
onBeforeRouteLeave(async (to, from, next) => {
|
const addToBookShelfConfirm = async () => {
|
||||||
按下返回键时不能触发 ElMessageBox.confirm
|
|
||||||
const bookUrl = sessionStorage.getItem("bookUrl");
|
const bookUrl = sessionStorage.getItem("bookUrl");
|
||||||
const bookName = sessionStorage.getItem("bookName");
|
const bookName = sessionStorage.getItem("bookName");
|
||||||
const isSeachBook = sessionStorage.getItem("isSeachBook");
|
const isSeachBook = sessionStorage.getItem("isSeachBook");
|
||||||
@@ -555,7 +554,10 @@ onBeforeRouteLeave(async (to, from, next) => {
|
|||||||
sessionStorage.removeItem("isSeachBook");
|
sessionStorage.removeItem("isSeachBook");
|
||||||
// 阅读的是搜索的书籍 并未在书架
|
// 阅读的是搜索的书籍 并未在书架
|
||||||
if (isSeachBook === "true") {
|
if (isSeachBook === "true") {
|
||||||
await ElMessageBox.confirm(
|
const addtoshelf = window.confirm(`是否将《${bookName}》放入书架?`)
|
||||||
|
if (!addtoshelf) await API.deleteBook(book);
|
||||||
|
//按下返回键时不能触发 ElMessageBox.confirm
|
||||||
|
/* await ElMessageBox.confirm(
|
||||||
`是否将《${bookName}》放入书架?`,
|
`是否将《${bookName}》放入书架?`,
|
||||||
"放入书架",
|
"放入书架",
|
||||||
{
|
{
|
||||||
@@ -568,11 +570,13 @@ onBeforeRouteLeave(async (to, from, next) => {
|
|||||||
}).catch(async () => {
|
}).catch(async () => {
|
||||||
//选择否,删除书籍
|
//选择否,删除书籍
|
||||||
await API.deleteBook(book);
|
await API.deleteBook(book);
|
||||||
})
|
}) */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
onBeforeRouteLeave(async (to, from, next) => {
|
||||||
|
await addToBookShelfConfirm();
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
**/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user