global.ts 832 B

1234567891011121314151617181920212223
  1. import type { App } from 'vue'
  2. import { transformStr, UTC2Date } from '@lincy/utils'
  3. function install(app: App) {
  4. app.mixin({
  5. mounted() {
  6. const blackComponents = ['router-link', 'keep-alive', 'transition-group', 'KeepAlive', 'BaseTransition', 'RouterView']
  7. const componentName = this.$options.name
  8. if (componentName && !componentName.includes('van-') && !blackComponents.includes(componentName)) {
  9. console.log(`%c[${UTC2Date('', 'yyyy-mm-dd hh:ii:ss.SSS')}] ${componentName} Mounted`, 'color: green')
  10. window[`$$${transformStr(componentName)}` as any] = this
  11. }
  12. },
  13. methods: {
  14. handleGoUrl(url: string) {
  15. window.location.href = url
  16. },
  17. },
  18. })
  19. }
  20. export default {
  21. install,
  22. }