import { createApp, ref } from "vue";
import { createPinia } from "pinia";

import App from "./App.vue";
import router from "./router";
import { createI18n } from "vue-i18n";
import en from "./locales/en";
import "./assets/base.css";
import "./assets/main.css";
import VueScrollTo from "vue-scrollto";
const userData = ref({});

const app = createApp(App);
app.config.globalProperties.$currentUser = userData;
const i18n = createI18n({
  locale: "en",
  fallbackLocale: "en",
  messages: {
    en,
  },
});

app.use(i18n);
app.use(createPinia());
app.use(router);
router.beforeEach((to, from, next) => {
  // 使用 VueScrollTo 滚动到顶部
  VueScrollTo.scrollTo("#app", 0);
  next();
});
app.mount("#app");
export default i18n;
