1234567891011121314151617181920212223 |
- import { ref, computed } from "vue";
- export const appEl = ref<HTMLElement>(null);
- export const showToolbox = ref(true);
- export const showToolbar = ref(false);
- // 当前系统的模式 分可读可写 预览编辑
- // 具体操作方式参考 https://juejin.cn/post/7000335920972955684
- export const modeFlags = {
- EDIT: 0b10,
- // 已经保存,是最新的
- SAVED: 0b100,
- // 可写模式,用户已登陆
- LOGIN: 0b1000,
- } as const;
- export type ModeFlag = typeof modeFlags[keyof typeof modeFlags];
- export const mode = ref<number>(modeFlags.SAVED | modeFlags.LOGIN);
- export const isEdit = computed(() => !!(mode.value & modeFlags.EDIT));
- export const isLogin = computed(() => !!(mode.value & modeFlags.LOGIN));
- export const isSave = computed(() => !(mode.value & modeFlags.SAVED));
- export const docDomain = `http://showdoc.4dage.com/`;
|