Browse Source

feat(EditorHeader): 添加全局setTitle方法用于设置标题

暴露setTitle方法到window对象,方便外部调用设置编辑器标题并同步到store
lsc 4 days ago
parent
commit
61588ca71a
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/views/Editor/EditorHeader/index.vue

+ 7 - 0
src/views/Editor/EditorHeader/index.vue

@@ -152,6 +152,13 @@ const enterStudentView = () => {
   // 通过路由跳转到学生模式
   // 通过路由跳转到学生模式
   window.location.href = '/?mode=student'
   window.location.href = '/?mode=student'
 }
 }
+
+const setTitle = (newTitle: string) => {
+  titleValue.value = newTitle
+  slidesStore.setTitle(newTitle)
+}
+
+(window as any).setTitle = setTitle
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>