You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nuxt3中使用@fullpage/nuxt-fullpage无区块显示求助

Nuxt3中@fullpage/nuxt-fullpage区块不显示的解决方法

以下是针对问题的排查和修复步骤:

  • 修正section结构规范
    fullpage.js要求每个页面区块必须是带有section类的元素,且需直接作为<full-page>的子元素。你当前的结构是把所有子区块嵌套在一个id="section"的div里,不符合组件要求。正确结构示例:
<template>
  <div class="content">
    <full-page
      :options="{
        licenseKey: null,
        css3: true,
        menu: '#navigation',
        anchors: ['home', 'services', 'pictures', 'prices', 'contact'],
      }"
    >
      <div class="section" data-anchor="home">
        <HomeBanner />
      </div>

      <div class="section" data-anchor="services">
        <HomeProductsTabsComponent />
      </div>

      <div class="section" data-anchor="pictures">
        <Experience />
      </div>
    </full-page>
  </div>
</template>
  • 确认样式正确引入
    如果模块未自动注入fullpage样式,手动在nuxt.config.js中添加全局样式:
export default defineNuxtConfig({
  css: [
    '@fullpage/nuxt-fullpage/dist/fullpage.css'
  ],
  modules: [
    '@nuxtjs/axios',
    'nuxt-swiper',
    '@nuxt/image',
    '@fullpage/nuxt-fullpage',
  ],
})
  • 排查控制台错误
    打开浏览器开发者工具控制台,检查是否存在以下问题:

    • 组件注册失败报错
    • 样式加载失败提示
    • 配置项错误(比如menu: '#navigation'对应的DOM元素是否存在)
  • 简化代码验证基础功能
    先移除自定义子组件,用纯文本测试基础功能是否正常,排除子组件影响:

<template>
  <full-page :options="{ licenseKey: null, css3: true }">
    <div class="section">首页区块</div>
    <div class="section">服务区块</div>
    <div class="section">案例区块</div>
  </full-page>
</template>

如果基础示例正常,再逐步添加子组件和配置项定位问题。

内容的提问来源于stack exchange,提问作者Ezzaa Waheed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 10:32:47