当前位置:   article > 正文

vue打包后直接本地访问index.html_vue打包后的项目怎么直接访问index.html

vue打包后的项目怎么直接访问index.html

以下方法可能有些项目并不生效

  1. vue.config.js 文件,没有的话就新建一个,并添加publicPath: './ ’

    module.exports = {
      publicPath: './'
    }
    
    • 1
    • 2
    • 3
  2. router.js 把mode改成hash模式

    const router = new Router({
      mode: "hash",
      routes
    });
    export default router;
    
    • 1
    • 2
    • 3
    • 4
    • 5
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/589019
推荐阅读
相关标签
  

闽ICP备14008679号