فهرست منبع

refactor(Editor): 将setTitle功能移至index3.vue并清理EditorHeader中的代码

移除EditorHeader中未使用的setTitle函数及相关全局挂载,将其功能整合到index3.vue中
lsc 3 هفته پیش
والد
کامیت
88c462253f
2فایلهای تغییر یافته به همراه15 افزوده شده و 7 حذف شده
  1. 5 5
      src/views/Editor/EditorHeader/index.vue
  2. 10 2
      src/views/Editor/index3.vue

+ 5 - 5
src/views/Editor/EditorHeader/index.vue

@@ -158,12 +158,12 @@ const enterStudentView = () => {
   window.location.href = '/?mode=student'
 }
 
-const setTitle = (newTitle: string) => {
-  titleValue.value = newTitle
-  slidesStore.setTitle(newTitle)
-}
+// const setTitle = (newTitle: string) => {
+//   titleValue.value = newTitle
+//   slidesStore.setTitle(newTitle)
+// }
 
-(window as any).setTitle = setTitle
+// (window as any).setTitle = setTitle
 </script>
 
 <style lang="scss" scoped>

+ 10 - 2
src/views/Editor/index3.vue

@@ -182,7 +182,7 @@
 <script lang="ts" setup>
 import { ref, computed, onMounted, onUnmounted } from 'vue'
 import { storeToRefs } from 'pinia'
-import { useMainStore } from '@/store'
+import { useMainStore, useSlidesStore } from '@/store'
 import useGlobalHotkey from '@/hooks/useGlobalHotkey'
 import usePasteEvent from '@/hooks/usePasteEvent'
 
@@ -203,6 +203,7 @@ import CollapsibleToolbar from '@/components/CollapsibleToolbar/index2.vue'
 import CreateCourseDialog from '@/components/CreateCourseDialog.vue'
 import api from '@/services/course'
 
+
 interface ParentWindowWithToolList extends Window {
   lastSteps?: () => void;
   setCouresTitle?: (title: string) => void;
@@ -223,6 +224,7 @@ const props = withDefaults(defineProps<Props>(), {
 })
 
 const mainStore = useMainStore()
+const slidesStore = useSlidesStore()
 const { dialogForExport, showSelectPanel, showSearchPanel, showNotesPanel, showMarkupPanel, showAIPPTDialog } = storeToRefs(mainStore)
 const closeExportDialog = () => mainStore.setDialogForExport('')
 const closeAIPPTDialog = () => mainStore.setAIPPTDialogState(false)
@@ -336,7 +338,13 @@ const getCourseDetail = async (courseid: string) => {
   handleCourseLoaded(res[0][0])
 }
 
-Object.assign(window, { getCourseDetail })
+const setTitle = (newTitle: string) => {
+  courseTitle.value = newTitle
+  slidesStore.setTitle(newTitle)
+}
+
+
+Object.assign(window, { getCourseDetail, setTitle })
 
 onMounted(() => {
   if (!props.courseid) {