Skip to content

Commit a5f3745

Browse files
committed
一级分类路由配置
1 parent 8e62bef commit a5f3745

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/directives/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export const lazyPlugin = {
99
mounted(el, binding) {
1010
//el:指令绑定元素
1111
//binding: bingding.value 指令等于号后面绑定的表达式的值 图片url
12-
console.log(el, binding.value)
12+
//console.log(el, binding.value)
1313
const targetIsVisible = shallowRef(false)
1414
const { stop } = useIntersectionObserver(
1515
el,
1616
([entry], observerElement) => {
1717
targetIsVisible.value = entry?.isIntersecting || false
18-
console.log(targetIsVisible.value)
18+
//console.log(targetIsVisible.value)
1919
if (targetIsVisible.value) {
2020
el.src = binding.value
2121
stop()

src/router/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const router = createRouter({
1616
component: Home
1717
},
1818
{
19-
path: 'category',
19+
path: 'category/:id',
2020
component: Category
2121
}
2222
]

src/views/Layout/components/LayoutFix.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const categoryStore = useCategoryStore()
1717
<!-- 导航区域 -->
1818
<ul class="app-header-nav">
1919
<li class="home" v-for="item in categoryStore.categoryList" :key="item.id">
20-
<RouterLink to="/">{{ item.name }}</RouterLink>
20+
<RouterLink :to="`/category/${item.id}`">{{ item.name }}</RouterLink>
2121
</li>
2222
</ul>
2323

src/views/Layout/components/LayoutHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const categoryStore = useCategoryStore()
1515
</h1>
1616
<ul class="app-header-nav">
1717
<li class="home" v-for="item in categoryStore.categoryList" :key="item.id">
18-
<RouterLink to="/">{{ item.name }}</RouterLink>
18+
<RouterLink :to="`/category/${item.id}`">{{ item.name }}</RouterLink>
1919
</li>
2020

2121
</ul>

0 commit comments

Comments
 (0)