-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
125 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import AxiosClient from "./axios"; | ||
|
||
const resource = "/index"; | ||
const resourceCategory = "/categories"; | ||
|
||
export default { | ||
get() { | ||
return AxiosClient.get(`${resource}`); | ||
}, | ||
getCategory() { | ||
return AxiosClient.get(`${resourceCategory}`) | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template lang=""> | ||
<div class="relative"> | ||
<div | ||
class="hover:text-gray-400 cursor-pointer flex items-center gap-1" | ||
@mouseenter="mouseEnter" | ||
@mouseleave="mouseLeave" | ||
> | ||
{{ props.name }} | ||
<Icon icon="pi-sort-down-fill" class="text-[#a6adc9] text-[0.6rem]"/> | ||
</div> | ||
<div | ||
v-if="isShow" | ||
@mouseenter="mouseEnter" | ||
@mouseleave="mouseLeave" | ||
class="w-fit absolute max-h-[24rem] top-4 left-0 shadow-lg bg-white rounded overflow-y-auto" | ||
> | ||
<router-link | ||
v-for="item in props.childrenNode" | ||
:to="{ name: 'exercise', params: { classId: item.slug } }" | ||
:key="item.slug" | ||
class="p-2 text-nowrap text-[#606266] text-[0.7rem] cursor-pointer hover:bg-slate-100/80 block" | ||
> | ||
{{ item.name }} | ||
</router-link> | ||
</div> | ||
</div> | ||
|
||
</template> | ||
|
||
<script setup> | ||
import { ref } from "vue"; | ||
import Icon from "@/components/Icon.vue"; | ||
const props = defineProps({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
childrenNode: { | ||
type: Array, | ||
required: true, | ||
} | ||
}); | ||
const isShow = ref(false); | ||
function mouseEnter() { | ||
isShow.value = true; | ||
} | ||
function mouseLeave() { | ||
isShow.value = false; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<template lang=""> | ||
<div class="text-xs hidden lg:flex uppercase font-semibold justify-between items-center flex-1"> | ||
<div class="flex gap-5"> | ||
<div | ||
v-for="cate in categoryData.value" | ||
:key="cate.id" | ||
> | ||
<SingleTab | ||
v-if="cate.children.length <= 0" | ||
:name="cate.name" | ||
:classId="cate.slug" | ||
/> | ||
<MutilTab | ||
v-else | ||
:name="cate.name" | ||
:children-node="cate.children" | ||
/> | ||
|
||
</div> | ||
</div> | ||
<Searchbar/> | ||
</div> | ||
|
||
<div class="flex lg:hidden justify-end flex-1 cursor-pointer"> | ||
<Icon icon="pi-bars" className="text-xl"/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import Searchbar from "@/components/Navbar/Searchbar.vue"; | ||
import Icon from "@/components/Icon.vue"; | ||
import { RepositoryFactory } from "@/api/RepositoryFactory"; | ||
import { onMounted, reactive } from "vue"; | ||
import SingleTab from "@/components/Navbar/SingleTab.vue"; | ||
import MutilTab from "@/components/Navbar/MutilTab.vue"; | ||
const categoryData = reactive([]); | ||
onMounted(async ()=> { | ||
const HomeRepository = RepositoryFactory.get("home"); | ||
const { data } = await HomeRepository.getCategory(); | ||
categoryData.value = data; | ||
console.log(categoryData.value); | ||
}); | ||
</script> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template lang=""> | ||
<router-link | ||
:to="{ name: 'exercise', params: { classId: props.classId } }" | ||
class="hover:text-gray-400" | ||
> | ||
{{ props.name }} | ||
</router-link> | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
classId: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters