You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<template>
<div>
<div>
<div>
<divclass="button"v-on:click="toggleFilter(null)">
All
</div>
<divclass="button"v-on:click="toggleFilter('design')">
Design
</div>
<divclass="button"v-on:click="toggleFilter('dev')">
Development
</div>
</div>
<divid="projects-list">
<ContentList:query="projectsQuery"v-slot="{ list }">
<nuxt-link:to="project.ref"v-for="project in list":key="project.index">
<pclass="project-name">{{project.title}}</p>
<smallclass="project-year">{{project.year}}</small>
</nuxt-link>
</ContentList>
</div>
</div>
</div>
</template>
<script>
exportdefault {data:function(){return { filter:null } }, computed:{projectsQuery:function(){// sorts list of projects by year descending, title A-Zlet baseQuery = { path:"/projects", sort: { title:1, year:-1 } };if (this.filter!=null){ baseQuery = {...baseQuery, where: { types: { $contains:this.filter } } } }return baseQuery; } }, methods:{toggleFilter:function(type){this.filter= type; } } }
</script>
Describe the bug
I am using a <ContentList> to render a list of items from one of my content folders.
I would like the user of the site to be able to filter the list using buttons. Each button corresponds to a category, and each item in the content folder has multiple categories described in its frontmatter like this:
ref: exampletitle: Example projecttypes:
- design
- devyear: 2021
I'm using the query prop on the ContentList to filter based on categories. I have created it as a computed property, as you can see in the Reproduction above.
The query does work when I specify it directly in the computed property before rendering the page, but it does not work when the query is set in response to the user clicking on a filter button. What I see instead is the list with the baseQuery I specified in my Reproduction above applied. The list does not change as the where parameter is added to it.
I have verified that the projectsQuery computed property is changing in response to the user input. It's just the content list that's not changing.
Am I doing something wrong? Is this an expected behavior? Or is this a bug?
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Environment
Darwin
v18.9.0
3.0.0-rc.13
0.6.1
[email protected]
vite
target
,app
,css
,modules
,content
,image
@nuxt/[email protected]
,@nuxt/[email protected]
-
Reproduction
Describe the bug
I am using a
<ContentList>
to render a list of items from one of my content folders.I would like the user of the site to be able to filter the list using buttons. Each button corresponds to a category, and each item in the content folder has multiple categories described in its frontmatter like this:
I'm using the query prop on the ContentList to filter based on categories. I have created it as a computed property, as you can see in the Reproduction above.
The query does work when I specify it directly in the computed property before rendering the page, but it does not work when the query is set in response to the user clicking on a filter button. What I see instead is the list with the
baseQuery
I specified in my Reproduction above applied. The list does not change as thewhere
parameter is added to it.I have verified that the
projectsQuery
computed property is changing in response to the user input. It's just the content list that's not changing.Am I doing something wrong? Is this an expected behavior? Or is this a bug?
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: