main.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { createApp } from 'vue'
  2. import App from './App.vue'
  3. import dayjs from 'dayjs'
  4. import 'dayjs/locale/zh-cn'
  5. import router from '../router/index-teacher'
  6. import vueFilter from '@/helpers/vueFilter'
  7. import { postMessage } from '@/helpers/native-message'
  8. import 'normalize.css'
  9. import '../styles/index.less'
  10. import { state } from '@/state'
  11. import { browser } from '@/helpers/utils'
  12. const app = createApp(App)
  13. // 将selects全局混入当前vue实例中
  14. // import activeButtonIcon from '@/common/images/icon_check.png';
  15. // import inactiveButtonIcon from '@/common/images/icon_default.png';
  16. // app.mixin({
  17. // data() {
  18. // return {
  19. // activeButtonIcon: activeButtonIcon,
  20. // inactiveButtonIcon: inactiveButtonIcon,
  21. // };
  22. // }
  23. // });
  24. postMessage(
  25. {
  26. api: 'getVersion'
  27. },
  28. (res: any) => {
  29. state.version = res.content.version
  30. console.log(res, 'version')
  31. }
  32. )
  33. // import Vconsole from 'vconsole'
  34. // const vconsole = new Vconsole()
  35. if (browser().isTeacher) {
  36. state.platformType = 'TEACHER'
  37. } else if (browser().isStudent) {
  38. state.platformType = 'STUDENT'
  39. } else {
  40. state.platformType = 'TEACHER'
  41. }
  42. dayjs.locale('zh-ch')
  43. app.config.globalProperties.$dayjs = dayjs
  44. app.config.globalProperties.$filters = vueFilter
  45. app.use(router)
  46. app.mount('#app')