Comments (5)
Then you need to add a method onSearch to update q and call fetch() again
from content.
@sajjadalis your Header us emitting q
event, then you can listen in you index.vue
and call $fetch
, see more on https://vuejs.org/v2/guide/components.html#Emitting-a-Value-With-an-Event
<Header ... @q="$fetch" />
from content.
@atinux Thanks for reply.
I tried this but its not working.
With only @q="$fetch"
, input field does not accept text, when i try to type it goes blank.
<Header :q="q" @q="$fetch" />
If i use @q="q = $event.target.value, $fetch"
then input and v-model works fine but doesn't filter content.
<Header :q="q" @q="q = $event.target.value, $fetch" />
from content.
@atinux Thanks for the help.
Is this the correct way to call onSearch method? It's working and filtering content, but i'm not sure if its require to call the whole await this.$content
again.
methods: {
async onSearch($event) {
this.q = $event.target.value;
this.posts = await this.$content('posts')
.search(this.q)
.fetch()
}
}
from content.
I think that you can call this.$fetch()
instead of this.$content('posts')..
from content.
Related Issues (20)
- When I set useHead in app.vue, the webpage title does not change after leaving the content-related page
- bug(search): unicode characters display wrong on indexed mode HOT 1
- Unwanted class added on anchor links when target="_self"
- Image path changed in when linking images in markdown content HOT 2
- queryContent matches on start of path not directory name
- Unable to install nuxt with @nuxt/content with pnpm
- Unable to start project after creation (#internal/nitro/virtual/app-config is not defined) HOT 2
- Typecheck fail: Property 'useNuxtImage' does not exist on type HOT 1
- How to disable warnings like this: WARN [Vue warn]: Failed to resolve component: G?
- Unable to start examples/essentials/hello-world example HOT 1
- hook 'content:file:beforeParse' not working
- hook 'content:file:beforeParse' not working
- SSR and client divergence when processing link
- The MDC files are available during development but not after the build process HOT 1
- Layout component rendering is duplicated HOT 3
- queryContent() removes child elements
- lazily import parsers
- Unable to unset option `content.markdown.anchorLinks.exclude` HOT 1
- When running nuxt generate, if there is a dot (".") in the path of a content file, the gives 404 HOT 1
- ERROR [nitro] [unhandledRejection] Cannot read properties of undefined (reading 'split')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from content.