javascriptCopy code
// nuxt.config.js
module.exports = {
mode: 'universal',
/* other configurations */
render: {
ssr: true, // Enable server-side rendering
},
};
javascriptCopy code
// pages/index.vue
export default {
async asyncData() {
// Fetch data for the page
},
// Other component configurations
head() {
return {
script: [
{
src: '/path/to/your/lazy-loaded-script.js',
defer: true,
},
],
};
},
};
javascriptCopy code
// pages/_slug.vue
export default {
async asyncData({ params }) {
// Fetch data based on dynamic route parameters (e.g., slug)
const data = await fetchData(params.slug);
return { data };
},
// Other component configurations
};