mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
refactor(modules/web): arrange storeToRefs destruct
This commit is contained in:
@@ -132,21 +132,21 @@ const {
|
||||
readSettingsVisible,
|
||||
miniInterface,
|
||||
showContent,
|
||||
config,
|
||||
readingBook,
|
||||
bookProgress,
|
||||
theme,
|
||||
isNight,
|
||||
} = storeToRefs(store);
|
||||
|
||||
const chapterPos = computed({
|
||||
get: () => readingBook.value.chapterPos,
|
||||
set: (value) => (readingBook.value.chapterPos = value),
|
||||
get: () => store.readingBook.chapterPos,
|
||||
set: (value) => (store.readingBook.chapterPos = value),
|
||||
});
|
||||
const chapterIndex = computed({
|
||||
get: () => readingBook.value.index,
|
||||
set: (value) => (readingBook.value.index = value),
|
||||
get: () => store.readingBook.index,
|
||||
set: (value) => (store.readingBook.index = value),
|
||||
});
|
||||
|
||||
const theme = computed(() => config.value.theme);
|
||||
const infiniteLoading = computed(() => config.value.infiniteLoading);
|
||||
const infiniteLoading = computed(() => store.config.infiniteLoading);
|
||||
|
||||
// 字体
|
||||
const fontFamily = computed(() => {
|
||||
@@ -208,7 +208,6 @@ const rightBarTheme = computed(() => {
|
||||
display: miniInterface.value && !showToolBar.value ? "none" : "block",
|
||||
};
|
||||
});
|
||||
const isNight = computed(() => theme.value == 6);
|
||||
|
||||
/**
|
||||
* pc移动端判断 最大阅读宽度修正
|
||||
|
||||
@@ -84,9 +84,7 @@ import { Search } from "@element-plus/icons-vue";
|
||||
import API from "@api";
|
||||
|
||||
const store = useBookStore();
|
||||
const { connectStatus, connectType, newConnect, shelf, isDark } = storeToRefs(store);
|
||||
|
||||
const isNight = computed(() => isDark.value);
|
||||
const isNight = computed(() => store.isNight);
|
||||
|
||||
const readingRecent = ref({
|
||||
name: "尚无阅读记录",
|
||||
@@ -101,8 +99,9 @@ const { showLoading, closeLoading, loadingWrapper, isLoading } = useLoading(
|
||||
"正在获取书籍信息"
|
||||
);
|
||||
|
||||
// 书架书籍和在线书籍搜索
|
||||
const books = shallowRef([]);
|
||||
|
||||
const shelf = computed(() => store.shelf);
|
||||
const search = ref("");
|
||||
const isSearching = ref(false);
|
||||
watchEffect(() => {
|
||||
@@ -119,7 +118,7 @@ watchEffect(() => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
//搜索在线书籍
|
||||
const searchBook = () => {
|
||||
if (search.value == "") return;
|
||||
books.value = [];
|
||||
@@ -150,6 +149,10 @@ const searchBook = () => {
|
||||
);
|
||||
};
|
||||
|
||||
//连接状态
|
||||
const connectStatus = computed(() => store.connectStatus);
|
||||
const connectType = computed(() => store.connectType);
|
||||
const newConnect = computed(() => store.newConnect);
|
||||
const setIP = () => {
|
||||
ElMessageBox.prompt(
|
||||
"请输入 IP 和端口 ( 如:127.0.0.1:9527 或者通过内网穿透的地址)",
|
||||
|
||||
Reference in New Issue
Block a user