mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	perf: wangeditor
This commit is contained in:
		
							parent
							
								
									294e4f6601
								
							
						
					
					
						commit
						0d694e9870
					
				@ -25,13 +25,17 @@ const {
 | 
				
			|||||||
  pureApp,
 | 
					  pureApp,
 | 
				
			||||||
  username,
 | 
					  username,
 | 
				
			||||||
  avatarsStyle,
 | 
					  avatarsStyle,
 | 
				
			||||||
  getDropdownItemStyle
 | 
					  getDropdownItemStyle,
 | 
				
			||||||
 | 
					  changeWangeditorLanguage
 | 
				
			||||||
} = useNav();
 | 
					} = useNav();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(
 | 
					watch(
 | 
				
			||||||
  () => locale.value,
 | 
					  () => locale.value,
 | 
				
			||||||
  () => {
 | 
					  () => {
 | 
				
			||||||
    changeTitle(route.meta);
 | 
					    changeTitle(route.meta);
 | 
				
			||||||
 | 
					    locale.value === "en"
 | 
				
			||||||
 | 
					      ? changeWangeditorLanguage(locale.value)
 | 
				
			||||||
 | 
					      : changeWangeditorLanguage("zh-CN");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -186,6 +186,8 @@ function setFalse(Doms): any {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(instance, ({ layout }) => {
 | 
					watch(instance, ({ layout }) => {
 | 
				
			||||||
 | 
					  // 设置wangeditorV5主题色
 | 
				
			||||||
 | 
					  body.style.setProperty("--w-e-toolbar-active-color", layout["epThemeColor"]);
 | 
				
			||||||
  switch (layout["layout"]) {
 | 
					  switch (layout["layout"]) {
 | 
				
			||||||
    case "vertical":
 | 
					    case "vertical":
 | 
				
			||||||
      toggleClass(true, isSelect, unref(verticalRef));
 | 
					      toggleClass(true, isSelect, unref(verticalRef));
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,8 @@ const {
 | 
				
			|||||||
  menuSelect,
 | 
					  menuSelect,
 | 
				
			||||||
  username,
 | 
					  username,
 | 
				
			||||||
  avatarsStyle,
 | 
					  avatarsStyle,
 | 
				
			||||||
  getDropdownItemStyle
 | 
					  getDropdownItemStyle,
 | 
				
			||||||
 | 
					  changeWangeditorLanguage
 | 
				
			||||||
} = useNav();
 | 
					} = useNav();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted(() => {
 | 
					onMounted(() => {
 | 
				
			||||||
@ -44,6 +45,9 @@ watch(
 | 
				
			|||||||
  () => locale.value,
 | 
					  () => locale.value,
 | 
				
			||||||
  () => {
 | 
					  () => {
 | 
				
			||||||
    changeTitle(route.meta);
 | 
					    changeTitle(route.meta);
 | 
				
			||||||
 | 
					    locale.value === "en"
 | 
				
			||||||
 | 
					      ? changeWangeditorLanguage(locale.value)
 | 
				
			||||||
 | 
					      : changeWangeditorLanguage("zh-CN");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,8 @@ const {
 | 
				
			|||||||
  pureApp,
 | 
					  pureApp,
 | 
				
			||||||
  username,
 | 
					  username,
 | 
				
			||||||
  avatarsStyle,
 | 
					  avatarsStyle,
 | 
				
			||||||
  getDropdownItemStyle
 | 
					  getDropdownItemStyle,
 | 
				
			||||||
 | 
					  changeWangeditorLanguage
 | 
				
			||||||
} = useNav();
 | 
					} = useNav();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let defaultActive = ref(null);
 | 
					let defaultActive = ref(null);
 | 
				
			||||||
@ -60,6 +61,9 @@ watch(
 | 
				
			|||||||
  () => locale.value,
 | 
					  () => locale.value,
 | 
				
			||||||
  () => {
 | 
					  () => {
 | 
				
			||||||
    changeTitle(route.meta);
 | 
					    changeTitle(route.meta);
 | 
				
			||||||
 | 
					    locale.value === "en"
 | 
				
			||||||
 | 
					      ? changeWangeditorLanguage(locale.value)
 | 
				
			||||||
 | 
					      : changeWangeditorLanguage("zh-CN");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,7 @@ import { remainingPaths } from "/@/router";
 | 
				
			|||||||
import { transformI18n } from "/@/plugins/i18n";
 | 
					import { transformI18n } from "/@/plugins/i18n";
 | 
				
			||||||
import { storageSession } from "/@/utils/storage";
 | 
					import { storageSession } from "/@/utils/storage";
 | 
				
			||||||
import { useAppStoreHook } from "/@/store/modules/app";
 | 
					import { useAppStoreHook } from "/@/store/modules/app";
 | 
				
			||||||
 | 
					import { i18nChangeLanguage } from "@wangeditor/editor";
 | 
				
			||||||
import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
 | 
					import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const errorInfo = "当前路由配置不正确,请检查配置";
 | 
					const errorInfo = "当前路由配置不正确,请检查配置";
 | 
				
			||||||
@ -109,6 +110,15 @@ export function useNav() {
 | 
				
			|||||||
    return remainingPaths.includes(path);
 | 
					    return remainingPaths.includes(path);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * 切换wangEditorV5国际化
 | 
				
			||||||
 | 
					   * @param language string 可选值 en、zh-CN
 | 
				
			||||||
 | 
					   * @returns void
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  function changeWangeditorLanguage(language: string): void {
 | 
				
			||||||
 | 
					    i18nChangeLanguage(language);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return {
 | 
					  return {
 | 
				
			||||||
    logout,
 | 
					    logout,
 | 
				
			||||||
    backHome,
 | 
					    backHome,
 | 
				
			||||||
@ -122,6 +132,7 @@ export function useNav() {
 | 
				
			|||||||
    pureApp,
 | 
					    pureApp,
 | 
				
			||||||
    username,
 | 
					    username,
 | 
				
			||||||
    avatarsStyle,
 | 
					    avatarsStyle,
 | 
				
			||||||
    getDropdownItemStyle
 | 
					    getDropdownItemStyle,
 | 
				
			||||||
 | 
					    changeWangeditorLanguage
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ onMounted(() => {
 | 
				
			|||||||
  }, 1500);
 | 
					  }, 1500);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const toolbarConfig = {};
 | 
					const toolbarConfig = { excludeKeys: "fullScreen" };
 | 
				
			||||||
const editorConfig = { placeholder: "请输入内容..." };
 | 
					const editorConfig = { placeholder: "请输入内容..." };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 组件销毁时,也及时销毁编辑器
 | 
					// 组件销毁时,也及时销毁编辑器
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user