element-plus/website/entry.js
jeremywu f3d24d6109
fix(popper): fix popper related style (#562)
* fix(popper): fix popper related style

* fix(popper): restore `onMount` hook, rewrite `Teleport` usage

* fix(popper): fix failed tests due to change

* fix(popper): - Fix popper initialiation method

* fix(popper): - Replace unref with internal defined unwrap function
2020-11-10 14:55:03 +08:00

57 lines
1.5 KiB
JavaScript

import { createApp, nextTick } from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './route.config'
import demoBlock from './components/demo-block'
import MainFooter from './components/footer'
import MainHeader from './components/header'
import SideNav from './components/side-nav'
import FooterNav from './components/footer-nav'
import title from './i18n/title'
import 'highlight.js/styles/color-brewer.css'
import './demo-styles/index.scss'
import './assets/styles/common.scss'
import './assets/styles/fonts/style.css'
import icon from './icon.json'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn') // todo: locale based on Doc site lang
import App from './app.vue'
import ElementPlus from 'element-plus'
import '../packages/theme-chalk/src/index.scss'
const app = createApp(App)
app.config.globalProperties.$icon = icon
app.component('DemoBlock', demoBlock)
app.component('MainFooter', MainFooter)
app.component('MainHeader', MainHeader)
app.component('SideNav', SideNav)
app.component('FooterNav', FooterNav)
const router = createRouter({
history: createWebHashHistory(),
routes,
})
app.use(ElementPlus)
app.use(router)
router.isReady().then(()=>{
router.afterEach(async route => {
await nextTick()
const data = title[route.meta.lang]
for (let val in data) {
if (new RegExp('^' + val, 'g').test(route.name)) {
document.title = data[val]
return
}
}
document.title = 'Element'
ga('send', 'event', 'PageView', route.name)
})
})
app.mount('#app')