question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request usage example for preFetch in the <script setup lang=ts> block of a component

See original GitHub issue

Description

When using the composition api with the setup attribute in the <script> tag of a single file component, it isn’t clear from the documents how to declare the preFetch method.

All the examples seem to be for the options api.


#...
<script setup lang=ts>

import {preFetch} from 'quasar/wrappers';

# then what?

#...
</script>

Documentation Section URL

https://quasar.dev/quasar-cli-webpack/prefetch-feature#using-prefetch-to-initialize-pinia-or-vuex-store-s-

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

TypeScript Support, SPA Mode

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rstoenescucommented, May 10, 2022

I don’t know if this was added in the docs prior or later after this thread, but you can find an example of it here

Screen Shot 2022-05-10 at 8 43 33 AM

https://quasar.dev/quasar-cli-vite/prefetch-feature#usage

It was there all along.

1reaction
metalsadmancommented, May 10, 2022

I don’t know if this was added in the docs prior or later after this thread, but you can find an example of it here Screen Shot 2022-05-10 at 8 43 33 AM https://quasar.dev/quasar-cli-vite/prefetch-feature#usage

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 101 guide to Script Setup in Vue 3 - VueDose
Don't you know about Script Setup yet? Check out this short article now and learn the nicest way to define a Vue component...
Read more >
Vue js Prefetch components - Stack Overflow
I solved this by creating a simple prefetch component that loads after a custom amount of time. Prefetch.vue <script> import LazyComp1 from ...
Read more >
<script setup> | Vue.js
<script setup> is a compile-time syntactic sugar for using Composition API inside Single-File Components (SFCs). It is the recommended syntax if you are ......
Read more >
Data Fetching · Get Started with Nuxt
Within your pages, components and plugins you can use useFetch to universally fetch from ... Example. app.vue <script setup>const { data: count }...
Read more >
Full Stack SvelteKit For Beginners - Joy of Code
Because we're using a full stack framework we can create endpoints that correspond ... For example .svelte-kit/runtime/components holds the template for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found