fix(web/sourceeditor): update el-checkbox usage; fix reactivity bugs;update isbooksource regex
This commit is contained in:
@@ -56,7 +56,7 @@ const startDebug = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isBookSource = computed(() => {
|
const isBookSource = computed(() => {
|
||||||
return /bookSource/.test(window.location.href);
|
return /bookSource/i.test(window.location.href);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<el-checkbox
|
<el-checkbox
|
||||||
size="large"
|
size="large"
|
||||||
border
|
border
|
||||||
:label="sourceUrl"
|
:value="sourceUrl"
|
||||||
:class="{
|
:class="{
|
||||||
error: isSaveError,
|
error: isSaveError,
|
||||||
edit: sourceUrl == currentSourceUrl,
|
edit: sourceUrl == currentSourceUrl,
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ const importSourceFile = () => {
|
|||||||
input.click();
|
input.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isBookSource = /bookSource/.test(window.location.href);
|
const isBookSource = /bookSource/i.test(window.location.href);
|
||||||
const outExport = () => {
|
const outExport = () => {
|
||||||
const exportFile = document.createElement("a");
|
const exportFile = document.createElement("a");
|
||||||
let sources =
|
let sources =
|
||||||
|
|||||||
@@ -60,7 +60,12 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
const store = useSourceStore();
|
const store = useSourceStore();
|
||||||
defineProps(["config"]);
|
defineProps(["config"]);
|
||||||
const currentSource = store.currentSource;
|
|
||||||
|
const currentSource = computed(() => store.currentSource);
|
||||||
|
/*
|
||||||
|
修改currentSource的属性 没有直接修改本身
|
||||||
|
const { currentSource } = storeToRefs(store);
|
||||||
|
*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ import { useSourceStore } from "@/store";
|
|||||||
|
|
||||||
const store = useSourceStore();
|
const store = useSourceStore();
|
||||||
|
|
||||||
const current_tab = store.currentTab;
|
const current_tab = computed({
|
||||||
|
get:() => store.currentTab,
|
||||||
|
set:(val) => store.currentTab = val
|
||||||
|
});
|
||||||
|
|
||||||
const tabData = ref([
|
const tabData = ref([
|
||||||
["editTab", "编辑源"],
|
["editTab", "编辑源"],
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ const redo = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const saveSource = () => {
|
const saveSource = () => {
|
||||||
let isBookSource = /bookSource/.test(location.href),
|
let isBookSource = /bookSource/i.test(location.href),
|
||||||
/** @type {import("@/source.js").Source} */
|
/** @type {import("@/source.js").Source} */
|
||||||
source = store.currentSource;
|
source = store.currentSource;
|
||||||
if (isInvaildSource(source)) {
|
if (isInvaildSource(source)) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const useSourceStore = defineStore("source", {
|
|||||||
/** @type {import("@/source").Source[]} */
|
/** @type {import("@/source").Source[]} */
|
||||||
savedSources: [], // 批量保存到阅读app成功的源
|
savedSources: [], // 批量保存到阅读app成功的源
|
||||||
/** @type {import("@/source").Source} */
|
/** @type {import("@/source").Source} */
|
||||||
currentSource: emptySource, // 当前编辑的源
|
currentSource: JSON.parse(JSON.stringify(emptySource)), // 当前编辑的源
|
||||||
currentTab: localStorage.getItem("tabName") || "editTab",
|
currentTab: localStorage.getItem("tabName") || "editTab",
|
||||||
editTabSource: {}, // 生成序列化的json数据
|
editTabSource: {}, // 生成序列化的json数据
|
||||||
isDebuging: false,
|
isDebuging: false,
|
||||||
@@ -119,7 +119,7 @@ export const useSourceStore = defineStore("source", {
|
|||||||
},
|
},
|
||||||
clearEdit() {
|
clearEdit() {
|
||||||
this.editTabSource = {};
|
this.editTabSource = {};
|
||||||
this.currentSource = emptySource;
|
this.currentSource = JSON.parse(JSON.stringify(emptySource)); //复制一份新对象
|
||||||
},
|
},
|
||||||
|
|
||||||
// clear all source
|
// clear all source
|
||||||
|
|||||||
Reference in New Issue
Block a user