-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathmain.js
67 lines (59 loc) · 1.86 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* eslint-disable no-console */
import 'docsearch.js/dist/cdn/docsearch.css';
import './index.less';
import 'nprogress/nprogress.css';
import { createApp, Transition, TransitionGroup, version as vueVersion } from 'vue';
import i18n from './i18n';
import NProgress from 'nprogress';
import router from './router';
import Antd from 'ant-design-vue';
import demoBox from './components/DemoBox.vue';
import demoContainer from './components/demoContainer.vue';
import demoSort from './components/demoSort.jsx';
import clipboard from './directives/clipboard';
import App from './App.vue';
console.log('vue version: ', vueVersion);
console.log('ant design vue version: ', Antd.version);
const app = createApp(App);
app.use(Antd);
app.use(clipboard);
app.component('Transition', Transition);
app.component('TransitionGroup', TransitionGroup);
app.component('DemoBox', demoBox);
app.component('DemoContainer', demoContainer);
app.component('DemoSort', demoSort);
app.component('VNodes', function (_, { attrs: { value } }) {
return value;
});
// app.component('tempVar', {
// functional: true,
// render: (h, ctx) => {
// return ctx.scopedSlots && ctx.scopedSlots.default && ctx.scopedSlots.default(ctx.props);
// },
// });
router.beforeEach((to, from, next) => {
if (to.path !== from.path) {
NProgress.start();
}
next();
});
router.afterEach((to, from) => {
if (to.path !== from.path) {
NProgress.done();
document.documentElement.scrollTop = 0;
}
});
app.use(router);
app.use(i18n);
app.config.globalProperties.$i18n = i18n;
app.mount('#app');
// setTimeout(() => {
// const clicked = localStorage.getItem('surveybyantdv_22_03_14');
// if (!clicked) {
// const btn = document.getElementsByClassName('surveybyantdv-launch-button')?.[0];
// if (btn) {
// btn.click();
// localStorage.setItem('surveybyantdv_22_03_14', true);
// }
// }
// }, 3000);