main.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { createApp } from 'vue'
  2. import { createPinia } from 'pinia'
  3. import App from './App.vue'
  4. import { lang } from '@/i18n/lang'
  5. export { lang }
  6. // TypeScript declarations for global properties
  7. declare module '@vue/runtime-core' {
  8. interface ComponentCustomProperties {
  9. $version: 'cn' | 'hk' | 'com'
  10. }
  11. }
  12. import '@icon-park/vue-next/styles/index.css'
  13. import 'prosemirror-view/style/prosemirror.css'
  14. import 'animate.css'
  15. import '@/assets/styles/prosemirror.scss'
  16. import '@/assets/styles/global.scss'
  17. import '@/assets/styles/font.scss'
  18. import Icon from '@/plugins/icon'
  19. import Directive from '@/plugins/directive'
  20. // 全局变量:判断当前版本 (cn/hk/com)
  21. export const getCurrentVersion = () => {
  22. const href = window.location.href.toLowerCase()
  23. if (href.includes('cn')) return 'cn'
  24. if (href.includes('hk')) return 'hk'
  25. if (href.includes('com')) return 'com'
  26. return 'cn' // 默认cn版本
  27. }
  28. // 当前版本
  29. export const currentVersion = getCurrentVersion()
  30. export default {currentVersion, lang}
  31. const app = createApp(App)
  32. // 注册全局变量
  33. app.config.globalProperties.$version = currentVersion
  34. app.use(Icon)
  35. app.use(Directive)
  36. app.use(createPinia())
  37. app.mount('#app')