Skip to content

Commit

Permalink
中途提交;
Browse files Browse the repository at this point in the history
  • Loading branch information
simply-none committed Jul 19, 2022
1 parent 6a14fb8 commit d66c6dd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [ElementUI](usage-frame/elementui知识点)
- [vue3迁移指南](usage-frame/vue3迁移指南.md)
- [Vue3](usage-frame/vue3知识点及其代码.md)
- [vue-router迁移指南](usage-frame/vue-router迁移指南.md)
- [NodeJs知识点](usage-frame/nodejs知识点.md)
- typescript
- [第一阶段知识点](usage-frame/typescript一期知识点.md)
Expand Down
25 changes: 25 additions & 0 deletions usage-frame/vue-router迁移指南.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# vue-router迁移指南

**创建路由**
- 不支持base属性,通过路由模式函数的第一个参数替代
- 不支持fallback属性,可以直接使用[html5 history api](https://developer.mozilla.org/zh-CN/docs/Web/API/History_API)进行历史会话访问

```javaScript
import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
// 路由模式
history: createWebHashHistory(),
// 路由对象数组
routers: []
})
```

**路由模式**:history选项的变更,它的值的切换需要从vue-router导入对应的函数,比如:
- `history`对应于`createWebHistory()`函数
- `hash`对应于`createWebHashHistory()`函数
- `abstract`对应于`createMemoryHistory()`函数

**单页面应用基路径设置**
- 基础路径作为路由模式函数的第一个参数传入,之后匹配的路由都会加上这个基础路径前缀
- 例如:`history: createWebHashHistory('/base-dir/')`

0 comments on commit d66c6dd

Please sign in to comment.