nuxt generate后html文件js不执行

最近给公司做官网,需要做seo优化,就选了nuxt。因为以前一直是传静态包就选用了npm run generate模式

刚使用这个框架,有几个问题问下

1.打包生成的.html静态文件有什么用,直接访问静态文件这里面的js是不执行的(vue生命周期失效,但是通过props传递的参数能在页面正常渲染),页面也不能跳转,而访问项目根目录时这几个静态文件删除了也不影响使用。

2.这种模式怎么做seo优化,除了首页查看源代码有源码,其他内页查看源代码都是js。(访问项目根目录模式)

3.内页刷新或者直接访问内页会直接报404。

访问项目根目录

丹鸿科技 https://dh2.hkxwjc.com/ruoyi-pc/

直接访问静态文件

丹鸿科技 https://dh2.hkxwjc.com/ruoyi-pc/index.html

访问内页

HTTP Status 404 – Not Found https://dh2.hkxwjc.com/ruoyi-pc/page/product?mid=2105

目录结构

img

nuxt.config.js配置文件

export default {
  // Target: https://go.nuxtjs.dev/config-target
  target: 'static',

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: '丹鸿科技',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [{
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        hid: 'description',
        name: 'description',
        content: ''
      },
      {
        name: 'format-detection',
        content: 'telephone=no'
      }
    ],
    link: [{
      rel: 'icon',
      type: 'image/x-icon',
      href: '/logo-icon.png'
    }]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    'element-ui/lib/theme-chalk/index.css',
    '@/assets/css/animate.min.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '@/plugins/element-ui'
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [],
  generate: {
    subFolders: false,
  },
/*  router: {
      mode:'hash',
      base: "/ruoyi-pc/dist/" //此为根目录,如果有具体目录需求按实际情况写
  }, */
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/],
  }
}


img