@crm-market/template-shared 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/custom.css +70 -0
- package/assets/css/remixicon.css +2782 -0
- package/assets/css/satoshi-font.css +31 -0
- package/assets/fonts/flaticon.css +463 -0
- package/assets/fonts/flaticon.eot +0 -0
- package/assets/fonts/flaticon.html +2153 -0
- package/assets/fonts/flaticon.svg +441 -0
- package/assets/fonts/flaticon.ttf +0 -0
- package/assets/fonts/flaticon.woff +0 -0
- package/assets/fonts/flaticon.woff2 +0 -0
- package/assets/fonts/remixicon.eot +0 -0
- package/assets/fonts/remixicon.svg +8230 -0
- package/assets/fonts/remixicon.ttf +0 -0
- package/assets/fonts/remixicon.woff +0 -0
- package/assets/fonts/remixicon.woff2 +0 -0
- package/assets/scss/_variables.scss +31 -0
- package/assets/scss/components/_about.scss +58 -0
- package/assets/scss/components/_authentication.scss +124 -0
- package/assets/scss/components/_backtoptop.scss +27 -0
- package/assets/scss/components/_banner.scss +396 -0
- package/assets/scss/components/_best-deals.scss +74 -0
- package/assets/scss/components/_blank.scss +40 -0
- package/assets/scss/components/_blog.scss +193 -0
- package/assets/scss/components/_cart.scss +108 -0
- package/assets/scss/components/_categories.scss +82 -0
- package/assets/scss/components/_checkout.scss +110 -0
- package/assets/scss/components/_dashboard.scss +388 -0
- package/assets/scss/components/_faq.scss +22 -0
- package/assets/scss/components/_filter-rang.scss +109 -0
- package/assets/scss/components/_footer.scss +270 -0
- package/assets/scss/components/_global.scss +550 -0
- package/assets/scss/components/_header.scss +587 -0
- package/assets/scss/components/_hurry.scss +52 -0
- package/assets/scss/components/_navbar.scss +1008 -0
- package/assets/scss/components/_offers.scss +689 -0
- package/assets/scss/components/_pagination.scss +71 -0
- package/assets/scss/components/_popup.scss +172 -0
- package/assets/scss/components/_preloader.scss +108 -0
- package/assets/scss/components/_products.scss +1147 -0
- package/assets/scss/components/_rtl.scss +806 -0
- package/assets/scss/components/_services.scss +16 -0
- package/assets/scss/components/_sidebar.scss +259 -0
- package/assets/scss/style.css +6676 -0
- package/assets/scss/style.css.map +1 -0
- package/assets/scss/style.scss +40 -0
- package/assets/webfonts/Satoshi-Bold.eot +0 -0
- package/assets/webfonts/Satoshi-Bold.woff +0 -0
- package/assets/webfonts/Satoshi-Bold.woff2 +0 -0
- package/assets/webfonts/Satoshi-Medium.eot +0 -0
- package/assets/webfonts/Satoshi-Medium.woff +0 -0
- package/assets/webfonts/Satoshi-Medium.woff2 +0 -0
- package/assets/webfonts/Satoshi-Regular.eot +0 -0
- package/assets/webfonts/Satoshi-Regular.woff +0 -0
- package/assets/webfonts/Satoshi-Regular.woff2 +0 -0
- package/components/AboutUs/AboutUsTuan.vue +25 -0
- package/components/AboutUs/Statistics.vue +42 -0
- package/components/AboutUs/SubscribeToTheNewsletter.vue +57 -0
- package/components/AddAddress/index.vue +70 -0
- package/components/BestSellers/Products.vue +1562 -0
- package/components/BestSellers/RecentlyViewed.vue +304 -0
- package/components/Cart/ProductQuantity.vue +29 -0
- package/components/Cart/index.vue +167 -0
- package/components/Categories/index.vue +305 -0
- package/components/ChangePassword/index.vue +71 -0
- package/components/Checkout/index.vue +192 -0
- package/components/Common/DashboardNavigation.vue +37 -0
- package/components/Common/PageBanner.vue +28 -0
- package/components/Common/ProductCard.vue +152 -0
- package/components/Common/Services.vue +58 -0
- package/components/Contact/ContactForm.vue +91 -0
- package/components/Contact/ContactInfo.vue +74 -0
- package/components/Dashboard/RecentOrder.vue +173 -0
- package/components/Dashboard/index.vue +79 -0
- package/components/EditAddress/index.vue +119 -0
- package/components/EditProfile/index.vue +97 -0
- package/components/FAQ/index.vue +121 -0
- package/components/FeaturedProduct/FeaturedProducts.vue +304 -0
- package/components/FeaturedProduct/Products.vue +1562 -0
- package/components/ForgotPassword/index.vue +51 -0
- package/components/Layout/BackToUp.vue +38 -0
- package/components/Layout/Copyright.vue +25 -0
- package/components/Layout/Footer.vue +183 -0
- package/components/Layout/FooterTwo.vue +165 -0
- package/components/Layout/LocationOption.vue +178 -0
- package/components/Layout/MiddleHeader.vue +229 -0
- package/components/Layout/MiddleHeaderThree.vue +204 -0
- package/components/Layout/MiddleHeaderTwo.vue +240 -0
- package/components/Layout/Navbar.vue +185 -0
- package/components/Layout/NavbarStyleFour.vue +334 -0
- package/components/Layout/NavbarStyleThree.vue +188 -0
- package/components/Layout/NavbarStyleTwo.vue +108 -0
- package/components/Layout/Preloader.vue +18 -0
- package/components/Layout/RTLSwitchBtn.vue +40 -0
- package/components/Layout/ResponsiveNavbar.vue +431 -0
- package/components/Layout/TopHeader.vue +130 -0
- package/components/Login/index.vue +94 -0
- package/components/MyAccount/index.vue +154 -0
- package/components/NewArrivals/Products.vue +1969 -0
- package/components/NewArrivals/RecentlyViewed.vue +304 -0
- package/components/OrderDetails/index.vue +77 -0
- package/components/OrderHistory/index.vue +197 -0
- package/components/PrivacyPolicy/index.vue +112 -0
- package/components/ProductDetails/ProductDetailsTab.vue +343 -0
- package/components/ProductDetails/ProductQuantity.vue +29 -0
- package/components/ProductDetails/RecentlyViewed.vue +304 -0
- package/components/ProductDetails/index.vue +268 -0
- package/components/Products/RecentlyViewed.vue +304 -0
- package/components/Products/index.vue +292 -0
- package/components/Register/index.vue +88 -0
- package/components/TermsConditions/index.vue +112 -0
- package/components/TrendingProducts/FeaturedProducts.vue +304 -0
- package/components/TrendingProducts/Products.vue +1564 -0
- package/components/Wishlist/ProductQuantity.vue +29 -0
- package/components/Wishlist/index.vue +128 -0
- package/composables/useCart.ts +149 -0
- package/composables/useCategories.ts +87 -0
- package/composables/useCheckout.ts +131 -0
- package/composables/useProducts.ts +162 -0
- package/composables/useSiteConfig.ts +236 -0
- package/composables/useTemplateSections.ts +74 -0
- package/e2e/cart.spec.ts +71 -0
- package/e2e/fixtures/mock-api.ts +166 -0
- package/e2e/homepage.spec.ts +65 -0
- package/e2e/layout.spec.ts +73 -0
- package/e2e/navigation.spec.ts +61 -0
- package/e2e/pages/cart.page.ts +44 -0
- package/e2e/pages/homepage.page.ts +46 -0
- package/e2e/playwright.config.ts +32 -0
- package/e2e/products.spec.ts +33 -0
- package/layouts/default.vue +94 -0
- package/layouts/inner.vue +70 -0
- package/nuxt.config.ts +86 -0
- package/package.json +38 -0
- package/pages/about-us.vue +12 -0
- package/pages/address.vue +10 -0
- package/pages/cart.vue +10 -0
- package/pages/categories.vue +10 -0
- package/pages/change-password.vue +10 -0
- package/pages/checkout.vue +10 -0
- package/pages/contact.vue +11 -0
- package/pages/dashboard.vue +10 -0
- package/pages/edit-address.vue +10 -0
- package/pages/edit-profile.vue +10 -0
- package/pages/faq.vue +10 -0
- package/pages/forgot-password.vue +10 -0
- package/pages/login.vue +10 -0
- package/pages/my-account.vue +10 -0
- package/pages/order-details.vue +10 -0
- package/pages/order-history.vue +10 -0
- package/pages/privacy-policy.vue +10 -0
- package/pages/product-details.vue +10 -0
- package/pages/products.vue +10 -0
- package/pages/register.vue +10 -0
- package/pages/terms-conditions.vue +10 -0
- package/pages/wishlist.vue +10 -0
- package/plugins/site-init.client.ts +24 -0
- package/plugins/vuetify.ts +18 -0
- package/types/index.ts +121 -0
- package/utils/image.ts +13 -0
- package/utils/store.ts +21 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['navbar navbar-expand-lg bg-white py-0', { sticky: isSticky }]">
|
|
3
|
+
<div class="container mw-1610">
|
|
4
|
+
<NuxtLink class="navbar-brand d-lg-none" to="/">
|
|
5
|
+
<img
|
|
6
|
+
:src="logoUrl || defaultLogo"
|
|
7
|
+
class="main-logo"
|
|
8
|
+
alt="logo"
|
|
9
|
+
/>
|
|
10
|
+
</NuxtLink>
|
|
11
|
+
<a
|
|
12
|
+
class="navbar-toggler"
|
|
13
|
+
href="javascript:void(0);"
|
|
14
|
+
@click="stateStoreInstance.onChangeShow"
|
|
15
|
+
>
|
|
16
|
+
<span class="burger-menu">
|
|
17
|
+
<span class="top-bar"></span>
|
|
18
|
+
<span class="middle-bar"></span>
|
|
19
|
+
<span class="bottom-bar"></span>
|
|
20
|
+
</span>
|
|
21
|
+
</a>
|
|
22
|
+
|
|
23
|
+
<ul class="categories-nav categories-style-three d-none d-lg-block">
|
|
24
|
+
<li class="categories-item dropdown">
|
|
25
|
+
<div
|
|
26
|
+
class="categories-link dropdown-toggle"
|
|
27
|
+
@click="toggleCategories"
|
|
28
|
+
:aria-pressed="show ? 'true' : 'false'"
|
|
29
|
+
:class="{ show: buttonShowState }"
|
|
30
|
+
>
|
|
31
|
+
<i class="ri-menu-2-line"></i>
|
|
32
|
+
<span>Browse Categories</span>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<ul class="dropdown-menu" :class="{ show: show }">
|
|
36
|
+
<li v-for="category in topLevelCategories" :key="category.id">
|
|
37
|
+
<template v-if="getSubcategories(category.id).length > 0">
|
|
38
|
+
<a
|
|
39
|
+
class="dropdown-item sub-dropdown dropdown-toggle"
|
|
40
|
+
href="javascript:void(0)"
|
|
41
|
+
@click="toggleSubDropdown(category.id)"
|
|
42
|
+
>
|
|
43
|
+
<i class="ri-folder-line"></i>
|
|
44
|
+
<span>{{ category.name }}</span>
|
|
45
|
+
</a>
|
|
46
|
+
|
|
47
|
+
<ul
|
|
48
|
+
class="dropdown-menu dropdown-menu-sub"
|
|
49
|
+
:class="{ show: activeSubDropdown === category.id }"
|
|
50
|
+
>
|
|
51
|
+
<li v-for="sub in getSubcategories(category.id)" :key="sub.id">
|
|
52
|
+
<NuxtLink
|
|
53
|
+
class="dropdown-item"
|
|
54
|
+
:to="`/products?categoryId=${sub.id}`"
|
|
55
|
+
>
|
|
56
|
+
{{ sub.name }}
|
|
57
|
+
</NuxtLink>
|
|
58
|
+
</li>
|
|
59
|
+
</ul>
|
|
60
|
+
</template>
|
|
61
|
+
<template v-else>
|
|
62
|
+
<NuxtLink
|
|
63
|
+
class="dropdown-item single-style"
|
|
64
|
+
:to="`/products?categoryId=${category.id}`"
|
|
65
|
+
>
|
|
66
|
+
{{ category.name }}
|
|
67
|
+
</NuxtLink>
|
|
68
|
+
</template>
|
|
69
|
+
</li>
|
|
70
|
+
<li v-if="topLevelCategories.length === 0">
|
|
71
|
+
<span class="dropdown-item text-muted">No categories</span>
|
|
72
|
+
</li>
|
|
73
|
+
</ul>
|
|
74
|
+
</li>
|
|
75
|
+
</ul>
|
|
76
|
+
|
|
77
|
+
<div class="collapse navbar-collapse">
|
|
78
|
+
<ul class="navbar-nav me-auto ms-68">
|
|
79
|
+
<li class="nav-item">
|
|
80
|
+
<NuxtLink class="nav-link" to="/"> Home </NuxtLink>
|
|
81
|
+
</li>
|
|
82
|
+
|
|
83
|
+
<li class="nav-item">
|
|
84
|
+
<NuxtLink class="nav-link" to="/products"> Products </NuxtLink>
|
|
85
|
+
</li>
|
|
86
|
+
|
|
87
|
+
<li class="nav-item">
|
|
88
|
+
<NuxtLink class="nav-link" to="/categories"> Categories </NuxtLink>
|
|
89
|
+
</li>
|
|
90
|
+
|
|
91
|
+
<li class="nav-item">
|
|
92
|
+
<NuxtLink class="nav-link" to="/about-us"> About </NuxtLink>
|
|
93
|
+
</li>
|
|
94
|
+
|
|
95
|
+
<li class="nav-item">
|
|
96
|
+
<NuxtLink class="nav-link" to="/contact"> Contact </NuxtLink>
|
|
97
|
+
</li>
|
|
98
|
+
</ul>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<ul
|
|
102
|
+
class="d-none d-lg-flex others-options grocery-options ps-0 mb-0 list-unstyled justify-content-end"
|
|
103
|
+
>
|
|
104
|
+
<li class="info" v-if="phone">
|
|
105
|
+
<a
|
|
106
|
+
:href="`tel:${phone}`"
|
|
107
|
+
class="text-decoration-none success-hover-bg"
|
|
108
|
+
>
|
|
109
|
+
<div class="d-flex align-items-center">
|
|
110
|
+
<div class="flex-shrink-0">
|
|
111
|
+
<i class="ri-phone-line"></i>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="flex-grow-1 ms-10">
|
|
114
|
+
<span>Hotline</span>
|
|
115
|
+
<h3>{{ phone }}</h3>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</a>
|
|
119
|
+
</li>
|
|
120
|
+
</ul>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<script lang="ts">
|
|
126
|
+
import { defineComponent, ref, watch, onMounted, computed } from "vue";
|
|
127
|
+
import stateStore from "~/utils/store";
|
|
128
|
+
|
|
129
|
+
import defaultLogoImg from "~/assets/images/grocery-shop-logo.png";
|
|
130
|
+
|
|
131
|
+
export default defineComponent({
|
|
132
|
+
name: "NavbarStyleThree",
|
|
133
|
+
setup() {
|
|
134
|
+
const isSticky = ref(false);
|
|
135
|
+
const show = ref(false);
|
|
136
|
+
const buttonShowState = ref(false);
|
|
137
|
+
const activeSubDropdown = ref<string | null>(null);
|
|
138
|
+
const stateStoreInstance = stateStore;
|
|
139
|
+
const defaultLogo = defaultLogoImg;
|
|
140
|
+
|
|
141
|
+
const { topLevelCategories, getSubcategories } = useCategories();
|
|
142
|
+
const { logoUrl, contactInfo } = useSiteConfig();
|
|
143
|
+
|
|
144
|
+
const phone = computed(() => contactInfo.value?.phone);
|
|
145
|
+
|
|
146
|
+
const toggleCategories = () => {
|
|
147
|
+
show.value = !show.value;
|
|
148
|
+
buttonShowState.value = !buttonShowState.value;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const toggleSubDropdown = (subDropdown: string) => {
|
|
152
|
+
activeSubDropdown.value =
|
|
153
|
+
activeSubDropdown.value === subDropdown ? null : subDropdown;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const handleScroll = () => {
|
|
157
|
+
const scrollPos = window.scrollY;
|
|
158
|
+
isSticky.value = scrollPos >= 100;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
onMounted(() => {
|
|
162
|
+
window.addEventListener("scroll", handleScroll);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
watch(isSticky, (newValue: any) => {
|
|
166
|
+
if (newValue) {
|
|
167
|
+
show.value = false;
|
|
168
|
+
buttonShowState.value = false;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
isSticky,
|
|
174
|
+
show,
|
|
175
|
+
buttonShowState,
|
|
176
|
+
toggleCategories,
|
|
177
|
+
toggleSubDropdown,
|
|
178
|
+
activeSubDropdown,
|
|
179
|
+
stateStoreInstance,
|
|
180
|
+
defaultLogo,
|
|
181
|
+
topLevelCategories,
|
|
182
|
+
getSubcategories,
|
|
183
|
+
logoUrl,
|
|
184
|
+
phone,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
</script>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="['navbar navbar-expand-lg bg-white ptb-6', { sticky: isSticky }]"
|
|
4
|
+
>
|
|
5
|
+
<div class="container mw-1610">
|
|
6
|
+
<NuxtLink class="navbar-brand d-lg-none" to="/">
|
|
7
|
+
<img
|
|
8
|
+
:src="logoUrl || defaultLogo"
|
|
9
|
+
class="main-logo"
|
|
10
|
+
alt="logo"
|
|
11
|
+
/>
|
|
12
|
+
</NuxtLink>
|
|
13
|
+
<a
|
|
14
|
+
class="navbar-toggler"
|
|
15
|
+
href="javascript:void(0);"
|
|
16
|
+
@click="stateStoreInstance.onChangeShow"
|
|
17
|
+
>
|
|
18
|
+
<span class="burger-menu">
|
|
19
|
+
<span class="top-bar"></span>
|
|
20
|
+
<span class="middle-bar"></span>
|
|
21
|
+
<span class="bottom-bar"></span>
|
|
22
|
+
</span>
|
|
23
|
+
</a>
|
|
24
|
+
|
|
25
|
+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
26
|
+
<ul class="navbar-nav me-auto">
|
|
27
|
+
<li class="nav-item">
|
|
28
|
+
<NuxtLink class="nav-link" to="/"> Home </NuxtLink>
|
|
29
|
+
</li>
|
|
30
|
+
|
|
31
|
+
<li class="nav-item">
|
|
32
|
+
<NuxtLink class="nav-link" to="/products"> Products </NuxtLink>
|
|
33
|
+
</li>
|
|
34
|
+
|
|
35
|
+
<li class="nav-item">
|
|
36
|
+
<NuxtLink class="nav-link" to="/categories"> Categories </NuxtLink>
|
|
37
|
+
</li>
|
|
38
|
+
|
|
39
|
+
<li class="nav-item">
|
|
40
|
+
<NuxtLink class="nav-link" to="/about-us"> About </NuxtLink>
|
|
41
|
+
</li>
|
|
42
|
+
|
|
43
|
+
<li class="nav-item">
|
|
44
|
+
<NuxtLink class="nav-link" to="/contact"> Contact </NuxtLink>
|
|
45
|
+
</li>
|
|
46
|
+
</ul>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<ul
|
|
50
|
+
class="d-none d-lg-flex others-options grocery-options ps-0 mb-0 list-unstyled justify-content-end"
|
|
51
|
+
>
|
|
52
|
+
<li class="info" v-if="phone">
|
|
53
|
+
<a
|
|
54
|
+
:href="`tel:${phone}`"
|
|
55
|
+
class="text-decoration-none success-hover-bg"
|
|
56
|
+
>
|
|
57
|
+
<div class="d-flex align-items-center">
|
|
58
|
+
<div class="flex-shrink-0">
|
|
59
|
+
<i class="ri-phone-line"></i>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="flex-grow-1 ms-10">
|
|
62
|
+
<span>Hotline</span>
|
|
63
|
+
<h3>{{ phone }}</h3>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</a>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script lang="ts">
|
|
74
|
+
import { defineComponent, ref, onMounted, computed } from "vue";
|
|
75
|
+
import stateStore from "~/utils/store";
|
|
76
|
+
|
|
77
|
+
import defaultLogoImg from "~/assets/images/grocery-shop-logo.png";
|
|
78
|
+
|
|
79
|
+
export default defineComponent({
|
|
80
|
+
name: "NavbarStyleTwo",
|
|
81
|
+
setup() {
|
|
82
|
+
const isSticky = ref(false);
|
|
83
|
+
const stateStoreInstance = stateStore;
|
|
84
|
+
const defaultLogo = defaultLogoImg;
|
|
85
|
+
|
|
86
|
+
const { logoUrl, contactInfo } = useSiteConfig();
|
|
87
|
+
|
|
88
|
+
const phone = computed(() => contactInfo.value?.phone);
|
|
89
|
+
|
|
90
|
+
const handleScroll = () => {
|
|
91
|
+
const scrollPos = window.scrollY;
|
|
92
|
+
isSticky.value = scrollPos >= 100;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
window.addEventListener("scroll", handleScroll);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
isSticky,
|
|
101
|
+
stateStoreInstance,
|
|
102
|
+
defaultLogo,
|
|
103
|
+
logoUrl,
|
|
104
|
+
phone,
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="preloader">
|
|
3
|
+
<div class="preloader">
|
|
4
|
+
<div class="waviy">
|
|
5
|
+
<span>T</span>
|
|
6
|
+
<span>U</span>
|
|
7
|
+
<span>A</span>
|
|
8
|
+
<span>N</span>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: "Preloader",
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="settings-btn rtl-btn">
|
|
3
|
+
<label id="switch" class="switch">
|
|
4
|
+
<input type="checkbox" @change="toggleRTL" id="slider" />
|
|
5
|
+
<span class="slider round"></span>
|
|
6
|
+
</label>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent, onMounted, ref } from "vue";
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: "RTLSwitchBtn",
|
|
15
|
+
setup() {
|
|
16
|
+
const isRTLEnabled = ref(false);
|
|
17
|
+
|
|
18
|
+
const toggleRTL = () => {
|
|
19
|
+
isRTLEnabled.value = !isRTLEnabled.value;
|
|
20
|
+
document.body.classList.toggle("rtl", isRTLEnabled.value);
|
|
21
|
+
localStorage.setItem("isRTLEnabled", JSON.stringify(isRTLEnabled.value));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
const savedRTLEnabled = localStorage.getItem("isRTLEnabled");
|
|
26
|
+
if (savedRTLEnabled) {
|
|
27
|
+
isRTLEnabled.value = JSON.parse(savedRTLEnabled);
|
|
28
|
+
if (isRTLEnabled.value) {
|
|
29
|
+
document.body.classList.add("rtl");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
toggleRTL,
|
|
36
|
+
isRTLEnabled,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
</script>
|