记VueRouter4.0.0-beta.3在gitee page上的使用问题
tools:Vue-3.0.0、Vite-1.0.0-RC.4 、VueRouter4.0.0-beta.3、Gitee page
先抛结果,createWebHistory
和createWebHashHistory
二者差异导致的。
一开始,我用的createWebHistory
,在本地yarn dev
、hs dist -c-1
都没问题,部署到gitee page上network请求也都是200,可#app
里没东西,控制台也不报错,如图:
调试过程中,页面的表现也前后不太一致。在main.ts
中添加console.log
调试,一开始mount前的log可以执行、mount后的代码不执行,可是我在use
和mount
中间添加log后,连更新两次,log全执行了。
在APP里加了些其他内容,APP页面的其他内容显示了,但<router-view/>
里的东西还是不出来,我把空标签展开,然后把路由模式改为createWebHashHistory
,就好了,就调试有点玄,本地能用,gitee上没法用。