Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setup(): Record {
const i18n = useI18n();
const router = useRouter();
const store = useStore();
const chart = ref(cloneDeep(defaultChart));
const createChart = (): void => {
// Prefill series data into store
store.commit("routeData", {prefill: chart.value.series});
router.push({name: "admin-charts-edit", params: {id: "new"}});
};
const onShow = (params: ModalChartPreviewParams): void => {
chart.value.series = [{expr: params.expr}];
};
return {
window.EventBus = new Vue()
Vue.use(Dropzone)
Vue.use(Vuex)
Vue.component('Loading', require('./components/common/Loading.vue').default)
Vue.component('PageScholar', require('./components/course/PageScholar.vue').default)
Vue.component('PageStudent', require('./components/students/PageStudent.vue').default)
Vue.component('Course', require('./components/common/Course.vue').default)
Vue.component('SingleCourse', require('./components/SingleCourse/SingleCourse.vue').default)
const store = new Vuex.Store({
strict: process.env.NODE_ENV !== 'production'
})
// eslint-disable-next-line no-unused-vars
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'history',
scrollBehavior () {
return { x: 0, y: 0 }
}
})
Vue.mixin(mixin)
const app = new Vue({
el: '#app',
router,
store
})
// eslint-disable-next-line no-console
console.log('%c Warning! %c If you are not developer, this may be dangerous for you account.', 'background: yellow; color: black; font-size: 24px; font-weight: bold;', 'background: red; color: white; font-size: 24px;')
window.EventBus = new Vue()
Vue.use(Dropzone)
Vue.use(Vuex)
Vue.component('Loading', require('./components/common/Loading.vue').default)
Vue.component('PageScholar', require('./components/course/PageScholar.vue').default)
Vue.component('PageStudent', require('./components/students/PageStudent.vue').default)
Vue.component('Course', require('./components/common/Course.vue').default)
Vue.component('SingleCourse', require('./components/SingleCourse/SingleCourse.vue').default)
const store = new Vuex.Store({
strict: process.env.NODE_ENV !== 'production'
})
// eslint-disable-next-line no-unused-vars
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'history',
scrollBehavior () {
return { x: 0, y: 0 }
}
})
Vue.mixin(mixin)
const app = new Vue({
el: '#app',
router,
store
})
// eslint-disable-next-line no-console
console.log('%c Warning! %c If you are not developer, this may be dangerous for you account.', 'background: yellow; color: black; font-size: 24px; font-weight: bold;', 'background: red; color: white; font-size: 24px;')
import admin from "@/views/admin";
import dashboards from "@/views/dashboards";
const routes = Array().concat(
{
path: "/",
name: "root",
redirect: {
name: "dashboards-home",
},
},
...admin,
...dashboards,
);
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
linkActiveClass: "",
linkExactActiveClass: "active",
});
export default router;
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
// Each time route is changing, store previous route location and reset
// error from store.
if (from.name && to.name !== from.name && !isEqual(to.params, from.params)) {
store.commit("prevRoute", from);
}
store.commit("error", null);
import dashboards from "@/views/dashboards";
const routes = Array().concat(
{
path: "/",
name: "root",
redirect: {
name: "dashboards-home",
},
},
...admin,
...dashboards,
);
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
linkActiveClass: "",
linkExactActiveClass: "active",
});
export default router;
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
// Each time route is changing, store previous route location and reset
// error from store.
if (from.name && to.name !== from.name && !isEqual(to.params, from.params)) {
store.commit("prevRoute", from);
}
store.commit("error", null);
store.commit(
"routeData",
!clear
? {
invalid: {
general: invalid.value,
},
link: link.value,
items: dashboard.value?.items?.length ?? 0,
variables: variables.value?.length ?? 0,
}
: null,
);
};
onBeforeRouteLeave(beforeRoute);
onBeforeRouteUpdate(beforeRoute);
onBeforeMount(() => applyRouteParams());
onMounted(() => {
ui.title(`${i18n.t("labels.dashboards._", 2)} – ${i18n.t("labels.adminPanel")}`);
reset(true);
});
onBeforeUnmount(() => updateRouteData(true));
// watch(
// dashboard,
// async to => {
store.commit(
"routeData",
!clear
? {
filters: provider.value?.filters?.length ?? 0,
invalid: {
general: invalid.value,
},
}
: null,
);
};
onBeforeRouteLeave(beforeRoute);
onBeforeRouteUpdate(beforeRoute);
onBeforeMount(() => applyRouteParams());
onMounted(() => {
ui.title(`${i18n.t("labels.providers._", 2)} – ${i18n.t("labels.adminPanel")}`);
reset(true);
});
onBeforeUnmount(() => updateRouteData(true));
watch(
() => provider.value?.connector.type,
async to => {
support.value = to
? await defineAsyncComponent(() => import(/* webpackMode: "eager" */ `./form/${to}.vue`))
import VueRouter from "vue-router";
import Login from './auth/login.vue';
import DashBoard from './dashboard/main.vue'
import Game from './game/game.vue';
// const Game = () => import('./game/game.vue');
import store from './store';
const Initialize = Vue.component("Initialize", {
data: () => ({
message: "Loading...",
}),
template: "<div>{{ message }}</div>",
});
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/', redirect: '/dashboard',
},
{
path: '/_load', component: Initialize,
},
{
path: '/auth', component: { template: "" },
children: [
{ path: 'login', component: Login },
{
path: 'logout',
beforeEnter: (to, from, next) => {
axios.post("/api/logout").then(() => {
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuikit from 'vuikit/src/install.esm'
import VuikitIcons from '@vuikit/icons'
import routes from './routes'
import '@vuikit/theme'
Vue.use(VueRouter)
Vue.use(Vuikit)
Vue.use(VuikitIcons)
// register Story components
Vue.component('StoryPositions', require('./components/story-positions.vue').default)
const router = new VueRouter({
history: true,
linkActiveClass: 'uk-active',
routes
})
/* eslint-disable no-new */
new Vue({
provide: {
config: {}
},
router,
render: h => h('router-view')
}).$mount('#app')
import Vue from "vue";
import Router from "vue-router";
import Vuex from "vuex";
import Sync from "vuex-router-sync";
Vue.use(Vuex)
let rs = new Vuex.Store({
state: {} // 把router的状态同步到state对象
});
export const router = new Router({
base: '/',
routes: [
{
path: '/',
component: () =>
import ('../view/esview/home/home.vue')
},
{
path: '/render',
component: () =>
import ('../view/esview/render.vue')
}
]
})
Sync.sync(rs, router, {