feat: product options, speedup home page, themes
This commit is contained in:
@@ -5,22 +5,38 @@ import { VueTelegramPlugin } from 'vue-tg';
|
||||
import { router } from './router';
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
const config = {
|
||||
night_auto: false,
|
||||
theme: {
|
||||
light: 'fantasy',
|
||||
dark: 'dark',
|
||||
}
|
||||
};
|
||||
|
||||
const pinia = createPinia();
|
||||
const app = createApp(App);
|
||||
app
|
||||
.use(pinia)
|
||||
.use(router)
|
||||
.use(VueTelegramPlugin);
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
import { useMiniApp, useTheme } from 'vue-tg';
|
||||
const productsStore = useProductsStore();
|
||||
productsStore.fetchHomeProducts();
|
||||
const categoriesStore = useCategoriesStore();
|
||||
categoriesStore.fetchTopCategories();
|
||||
|
||||
const theme = useTheme();
|
||||
const tg = useMiniApp();
|
||||
import {useProductsStore} from "@/stores/ProductsStore.js";
|
||||
import {useCategoriesStore} from "@/stores/CategoriesStore.js";
|
||||
|
||||
theme.onChange(() => {
|
||||
document.documentElement.setAttribute('data-theme', theme.colorScheme.value);
|
||||
});
|
||||
if (config.night_auto) {
|
||||
window.Telegram.WebApp.onEvent('themeChanged', function () {
|
||||
document.documentElement.setAttribute('data-theme', config.theme[this.colorScheme]);
|
||||
});
|
||||
} else {
|
||||
document.documentElement.setAttribute('data-theme', config.theme.light);
|
||||
}
|
||||
|
||||
document.documentElement.setAttribute('data-theme', theme.colorScheme.value);
|
||||
window.Telegram.WebApp.ready();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user