sanmu
authored
|
1
2
|
<template>
<v-container>
|
sanmu
authored
|
3
4
|
<v-row class="tw-m-auto tw-flex tw-items-center">
<v-col cols="2" class="pa-0 tw-h-[64px]">
|
sanmu
authored
|
5
|
<router-link to="/"><v-img src="/logo.jpg" /></router-link>
|
sanmu
authored
|
6
7
|
</v-col>
<v-col cols="6" class="px-0">
|
sanmu
authored
|
8
|
<v-text-field
|
sanmu
authored
|
9
|
label="Search keyword"
|
sanmu
authored
|
10
11
12
|
hide-details="auto"
variant="solo"
append-inner-icon="mdi-magnify"
|
sanmu
authored
|
13
|
@click:appendInner="handleClick"
|
sanmu
authored
|
14
|
@keydown="handleKeyDown"
|
sanmu
authored
|
15
|
v-model="input"
|
sanmu
authored
|
16
17
|
>
</v-text-field>
|
sanmu
authored
|
18
19
20
21
22
23
24
|
</v-col>
<v-col cols="4" class="px-0">
<v-btn variant="text" @click="dialogStore.updateDialog(true)" color="blue-darken-2 mt-4"
>Concat Us
</v-btn>
</v-col>
</v-row>
|
sanmu
authored
|
25
|
</v-container>
|
sanmu
authored
|
26
|
<div class="tabs">
|
sanmu
authored
|
27
|
<div class="tw-max-w-[1200px] tw-mx-auto">
|
sanmu
authored
|
28
|
<v-tabs
|
sanmu
authored
|
29
|
mobile-breakpoint="580"
|
sanmu
authored
|
30
31
32
|
v-model="tab"
bg-color="blue-darken-1"
slider-color="grey-lighten-3"
|
sanmu
authored
|
33
34
|
tab-slider-size="6px"
selected-class="active"
|
sanmu
authored
|
35
|
:grow="screenWidth > 600 ? false : true"
|
sanmu
authored
|
36
|
>
|
sanmu
authored
|
37
38
39
40
41
42
|
<v-tab :value="1" to="/"
><span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">Home</span>
</v-tab>
<v-tab :value="2" to="/products">
<span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">Products</span>
</v-tab>
|
sanmu
authored
|
43
|
<v-tab :value="3" to="/about"
|
sanmu
authored
|
44
45
|
><span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">About</span>
</v-tab>
|
sanmu
authored
|
46
|
<!-- <v-tab :value="4" to="/contact"
|
sanmu
authored
|
47
|
><span class="text-grey-lighten-3 tw-font-bold">Contact</span></v-tab
|
sanmu
authored
|
48
|
> -->
|
sanmu
authored
|
49
50
51
|
</v-tabs>
</div>
</div>
|
sanmu
authored
|
52
|
<ContactDialog dialog />
|
sanmu
authored
|
53
54
55
|
</template>
<script setup lang="ts">
|
sanmu
authored
|
56
|
import { ref, watchEffect } from 'vue'
|
sanmu
authored
|
57
|
import ContactDialog from '@/components/ContactDialog.vue'
|
sanmu
authored
|
58
|
import { useProductListStore } from '@/stores/product_list'
|
sanmu
authored
|
59
60
|
import { useRouter } from 'vue-router'
import { useDialogStore } from '@/stores/dialog'
|
sanmu
authored
|
61
|
import { useCategoryStore } from '@/stores/category'
|
sanmu
authored
|
62
63
64
65
|
import { useDisplay } from 'vuetify'
const { width: screenWidth } = useDisplay()
|
sanmu
authored
|
66
|
const dialogStore = useDialogStore()
|
sanmu
authored
|
67
68
|
const productStore = useProductListStore()
|
sanmu
authored
|
69
|
const categoryStore = useCategoryStore()
|
sanmu
authored
|
70
71
72
|
const input = ref()
|
sanmu
authored
|
73
74
75
76
77
78
79
80
|
const router = useRouter()
const handleKeyDown = (e: any) => {
if (e.keyCode == 13) {
handleClick()
}
}
|
sanmu
authored
|
81
|
const handleClick = () => {
|
sanmu
authored
|
82
|
categoryStore.updateDisplay(!input.value)
|
sanmu
authored
|
83
|
productStore.updateKeyword(input.value)
|
sanmu
authored
|
84
85
|
productStore.updatePageNo(1)
router.push('/products')
|
sanmu
authored
|
86
|
}
|
sanmu
authored
|
87
88
|
const tab = ref(1)
|
sanmu
authored
|
89
90
91
92
93
94
95
96
97
|
const handleTabClick = () => {
categoryStore.updateDisplay(true)
productStore.updateKeyword('')
}
watchEffect(() => {
input.value = productStore.keyword
})
|
sanmu
authored
|
98
99
100
101
|
</script>
<style lang="scss" scoped>
.tabs {
|
sanmu
authored
|
102
|
background-color: #1f88e5;
|
sanmu
authored
|
103
|
}
|
sanmu
authored
|
104
105
106
107
108
109
|
.active :deep {
.v-tab__slider {
bottom: 3px;
}
}
|
sanmu
authored
|
110
|
</style>
|