Coder Social home page Coder Social logo

jackchoumine / vue3-dashboard Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 241 KB

vue3-dashboard 微应用 实践微前端

Home Page: https://jackchoumine.github.io/vue3-dashboard/

JavaScript 18.33% HTML 1.62% Vue 80.05%
vue3-demo vue microfrontend microservice

vue3-dashboard's Introduction

vue3-dashboard

vue3-dashboard 微应用 实践微前端

如何部署到 gh-pages?

How to deploy React App to GitHub Pages

如何解决切换路由后刷新浏览器 404 ?

设置两个地方

  1. 把仓库名字作为基础路径
const isProd = process.env.NODE_ENV === 'production'
const history = isMemoryHistory
  ? createMemoryHistory(basePath)
  : createWebHistory(isProd ? '/vue3-dashboard' : undefined) // 生产环境才设置基础路径
  1. 设置自定义错误页面

添加一个 404.html,内容和 index.html一样当找不到路径时,会渲染 404.html.

每次复制文件也麻烦,我是每次执行部署,脚本执行成功后复制 index.html 为 404.html

 "build": "webpack --config config/webpack.prod.js --progress",
 "postbuild": "cp dist/index.html dist/404.html",
 "predeploy": "npm run build",
 "deploy": "gh-pages -d dist"

其他解决办法:

使用 hash 模式,然后根据这个设置一下 部署 vue 到 GitHub Pages:404 頁面

我没试过,不知道能否成功。

我还试了单页应用在 gh-pages 动态路由刷新后 404 解决方案,没成功。

更多方法,参考 How to fix HTTP 404 on Github Pages?

react 项目如何解决 404 问题?

尝试了 vue 类似的解决办法,没成功,要是你有个更好的办法,感谢告诉我。

vue3-dashboard's People

Stargazers

Hayden Bickerton avatar

Watchers

James Cloos avatar QiJun Zhou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.