|
@@ -545,9 +545,8 @@ onUnmounted(() => {
|
|
|
scrollObserver = null;
|
|
scrollObserver = null;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
-onBeforeRouteLeave(async (to, from, next) => {
|
|
|
|
|
- 按下返回键时不能触发 ElMessageBox.confirm
|
|
|
|
|
|
|
+
|
|
|
|
|
+const addToBookShelfConfirm = async () => {
|
|
|
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,24 +554,29 @@ onBeforeRouteLeave(async (to, from, next) => {
|
|
|
sessionStorage.removeItem("isSeachBook");
|
|
sessionStorage.removeItem("isSeachBook");
|
|
|
// 阅读的是搜索的书籍 并未在书架
|
|
// 阅读的是搜索的书籍 并未在书架
|
|
|
if (isSeachBook === "true") {
|
|
if (isSeachBook === "true") {
|
|
|
- await ElMessageBox.confirm(
|
|
|
|
|
- `是否将《${bookName}》放入书架?`,
|
|
|
|
|
- "放入书架",
|
|
|
|
|
- {
|
|
|
|
|
- confirmButtonText: "确认",
|
|
|
|
|
- cancelButtonText: "否",
|
|
|
|
|
- type: "info"
|
|
|
|
|
- }
|
|
|
|
|
- ).then(() => {
|
|
|
|
|
- //选择是,无动作
|
|
|
|
|
- }).catch(async () => {
|
|
|
|
|
- //选择否,删除书籍
|
|
|
|
|
- await API.deleteBook(book);
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const addtoshelf = window.confirm(`是否将《${bookName}》放入书架?`)
|
|
|
|
|
+ if (!addtoshelf) await API.deleteBook(book);
|
|
|
|
|
+ //按下返回键时不能触发 ElMessageBox.confirm
|
|
|
|
|
+/* await ElMessageBox.confirm(
|
|
|
|
|
+ `是否将《${bookName}》放入书架?`,
|
|
|
|
|
+ "放入书架",
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: "确认",
|
|
|
|
|
+ cancelButtonText: "否",
|
|
|
|
|
+ type: "info"
|
|
|
|
|
+ }
|
|
|
|
|
+ ).then(() => {
|
|
|
|
|
+ //选择是,无动作
|
|
|
|
|
+ }).catch(async () => {
|
|
|
|
|
+ //选择否,删除书籍
|
|
|
|
|
+ await API.deleteBook(book);
|
|
|
|
|
+ }) */
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
+onBeforeRouteLeave(async (to, from, next) => {
|
|
|
|
|
+ await addToBookShelfConfirm();
|
|
|
next();
|
|
next();
|
|
|
});
|
|
});
|
|
|
-**/
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|