@fox-js/navigation 4.0.1-15 → 4.0.1-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +294 -294
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +263 -250
- package/dist/index.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +34 -34
- package/tsconfig.tsbuildinfo +1 -0
package/README.md
CHANGED
|
@@ -1,294 +1,294 @@
|
|
|
1
|
-
# fox-navigation
|
|
2
|
-
|
|
3
|
-
导航组件,支持动画过渡
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
### NPM
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
npm i @fox-js/navigation -S
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### YARN
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
yarn add @fox-js/navigation
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### PNPM
|
|
20
|
-
|
|
21
|
-
```shell
|
|
22
|
-
pnpm add @fox-js/navigation
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 使用说明
|
|
26
|
-
|
|
27
|
-
### fox-root-navigator
|
|
28
|
-
|
|
29
|
-
root导航组件,在入口vue文件(App.vue)上使用,支持新增页面的动画效果和拖曳关闭页面。
|
|
30
|
-
|
|
31
|
-
#### 基础用法
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
<script setup lang="ts">
|
|
35
|
-
import { usePageHelper } from '@/utils/custom'
|
|
36
|
-
// 获取page helper
|
|
37
|
-
const pageHelper = usePageHelper()
|
|
38
|
-
// 定义remove page函数
|
|
39
|
-
const removePage = () => {
|
|
40
|
-
pageHelper.remove()
|
|
41
|
-
}
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<template>
|
|
45
|
-
<fox-root-navigator :remove-page="removePage"></fox-root-navigator>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<style lang="scss">
|
|
49
|
-
</style>
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### 设置页面加载动画
|
|
54
|
-
|
|
55
|
-
##### 滑入方式
|
|
56
|
-
|
|
57
|
-
通过route的params属性设置animationType:'slide'
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
import { usePageHelper } from '@/utils/custom'
|
|
61
|
-
|
|
62
|
-
pageHelper.append({
|
|
63
|
-
path: target.route,
|
|
64
|
-
params: {
|
|
65
|
-
animationType:'slide'
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
##### 弹出方式
|
|
72
|
-
|
|
73
|
-
通过route的params属性设置animationType:'pop'
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
import { usePageHelper } from '@/utils/custom'
|
|
77
|
-
|
|
78
|
-
pageHelper.append({
|
|
79
|
-
path: target.route,
|
|
80
|
-
params: {
|
|
81
|
-
animationType:'pop'
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#### Props
|
|
89
|
-
|
|
90
|
-
| 字段 | 说明 | 类型 | 默认值 |
|
|
91
|
-
|------------------|----------------------------------------|---------|-----------|
|
|
92
|
-
| drag-remove | 是否支持拖曳关闭 | Boolean | true |
|
|
93
|
-
| remove-page | 关闭顶层页面方法 | Function | |
|
|
94
|
-
| router-view-name | router view名称 | String | `default` |
|
|
95
|
-
| view-tag | view tag标签 | Function/String | `div` |
|
|
96
|
-
| remove-move-ratio | 触发移除页面的移动比例(相对页面宽度) | Number | 0.5 |
|
|
97
|
-
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
## 插槽
|
|
102
|
-
|
|
103
|
-
| 名称 | 说明 |
|
|
104
|
-
|---------|------------------|
|
|
105
|
-
| default | 内容 |
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### fox-card-navigator
|
|
110
|
-
|
|
111
|
-
卡片导航组件,配合多标签页容器使用,具备缓存页面的能力。
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
#### 基础用法
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
<script setup lang="ts">
|
|
119
|
-
const rootName = $ref('_tab_view')
|
|
120
|
-
</script>
|
|
121
|
-
|
|
122
|
-
<template>
|
|
123
|
-
<fox-card-navigator
|
|
124
|
-
:router-view-name="rootName"
|
|
125
|
-
:transition="true"
|
|
126
|
-
></fox-card-navigator>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<style lang="scss">
|
|
130
|
-
</style>
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
#### Props
|
|
135
|
-
|
|
136
|
-
| 字段 | 说明 | 类型 | 默认值 |
|
|
137
|
-
|------------------|----------------------------------------|---------|-----------|
|
|
138
|
-
| router-view-name | router view名称 | String | `default` |
|
|
139
|
-
| transition | 是否支持过渡动画 | Boolean | false |
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## 插槽
|
|
144
|
-
|
|
145
|
-
| 名称 | 说明 |
|
|
146
|
-
|---------|------------------|
|
|
147
|
-
| default | 内容 |
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### fox-swiper-navigator
|
|
151
|
-
|
|
152
|
-
swiper导航组件,配合tab标签使用(例如手机端的主界面),支持拖曳新打开新页面/切换页面
|
|
153
|
-
|
|
154
|
-
#### 基础用法
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
<script lang="ts" setup>
|
|
158
|
-
import { onMounted, ref, computed } from 'vue'
|
|
159
|
-
import { usePageHelper } from '@/utils/custom'
|
|
160
|
-
import store from '@/store'
|
|
161
|
-
import tabs from './data'
|
|
162
|
-
const contentPadding = {
|
|
163
|
-
left: 0,
|
|
164
|
-
top: 0,
|
|
165
|
-
right: 0,
|
|
166
|
-
bottom: 0
|
|
167
|
-
}
|
|
168
|
-
// -------------- 导航设置 ---------------
|
|
169
|
-
// content width/height
|
|
170
|
-
const contentWidth = ref(0)
|
|
171
|
-
const contentHeight = ref(0)
|
|
172
|
-
// page ref
|
|
173
|
-
const pageRef = ref(null)
|
|
174
|
-
// root name
|
|
175
|
-
const rootName = ref('_tab_view')
|
|
176
|
-
// routes
|
|
177
|
-
const routes = computed(() => {
|
|
178
|
-
return tabs.map(tab => {
|
|
179
|
-
return {
|
|
180
|
-
path: tab.route
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
// active route path
|
|
185
|
-
const activeRoutePath = computed({
|
|
186
|
-
set: (newVal: string) => {
|
|
187
|
-
// 更新tab bar的index
|
|
188
|
-
index.value = routes.value.findIndex(r => {
|
|
189
|
-
return r.path === newVal
|
|
190
|
-
})
|
|
191
|
-
store.setCurrentRoutePath(newVal, rootName.value)
|
|
192
|
-
},
|
|
193
|
-
get: (): string => {
|
|
194
|
-
return store.getCurrentRoutePath(rootName.value) as string
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
// open page
|
|
198
|
-
const openPage = (route: any, index: number) => {
|
|
199
|
-
onTabChange(index)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// -------------tab bar 设置 ------------------
|
|
203
|
-
//当前tab索引
|
|
204
|
-
const index = ref(0)
|
|
205
|
-
// 获取page helper
|
|
206
|
-
const pageHelper = usePageHelper()
|
|
207
|
-
// tab change事件
|
|
208
|
-
const onTabChange = (index: any) => {
|
|
209
|
-
const tab = tabs[index]
|
|
210
|
-
// open页面
|
|
211
|
-
pageHelper.open(tab.route)
|
|
212
|
-
// 当前的route path到公共store中
|
|
213
|
-
store.setCurrentRoutePath(tab.route, rootName.value)
|
|
214
|
-
}
|
|
215
|
-
// content应用
|
|
216
|
-
const contentRef = ref(null)
|
|
217
|
-
// 加载后处理
|
|
218
|
-
onMounted(() => {
|
|
219
|
-
if (pageRef.value) {
|
|
220
|
-
const anyPage: any = pageRef.value
|
|
221
|
-
contentWidth.value = anyPage.getPageContentWidth()
|
|
222
|
-
if (contentWidth.value === 0) {
|
|
223
|
-
const anyContent: any = contentRef.value
|
|
224
|
-
contentWidth.value = anyContent.$el.offsetWidth
|
|
225
|
-
}
|
|
226
|
-
contentHeight.value = anyPage.getPageContentHeight()
|
|
227
|
-
}
|
|
228
|
-
// 当前选中tab index
|
|
229
|
-
let curIndex = index.value
|
|
230
|
-
// 获取之前保存的route path
|
|
231
|
-
let path = store.getCurrentRoutePath(rootName.value)
|
|
232
|
-
if (path) {
|
|
233
|
-
let i = tabs.findIndex(tab => {
|
|
234
|
-
return tab.route === path
|
|
235
|
-
})
|
|
236
|
-
curIndex = i !== -1 ? i : curIndex
|
|
237
|
-
// 更新tab的model
|
|
238
|
-
index.value = curIndex
|
|
239
|
-
}
|
|
240
|
-
// 触发页面跳转
|
|
241
|
-
onTabChange(curIndex)
|
|
242
|
-
})
|
|
243
|
-
</script>
|
|
244
|
-
|
|
245
|
-
<template>
|
|
246
|
-
<fox-page :content-padding="contentPadding" ref="pageRef">
|
|
247
|
-
<fox-footer-bar>
|
|
248
|
-
<fox-tabbar v-model="index" @change="onTabChange">
|
|
249
|
-
<template v-for="tab in tabs" :key="tab.title">
|
|
250
|
-
<fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
|
|
251
|
-
</template>
|
|
252
|
-
</fox-tabbar>
|
|
253
|
-
</fox-footer-bar>
|
|
254
|
-
<fox-content ref="contentRef">
|
|
255
|
-
<fox-swiper-navigator
|
|
256
|
-
v-model:activePath="activeRoutePath"
|
|
257
|
-
:router-view-name="rootName"
|
|
258
|
-
:routes="routes"
|
|
259
|
-
:open-page="openPage"
|
|
260
|
-
:transition="true"
|
|
261
|
-
:width="contentWidth"
|
|
262
|
-
:height="contentHeight"
|
|
263
|
-
></fox-swiper-navigator>
|
|
264
|
-
</fox-content>
|
|
265
|
-
</fox-page>
|
|
266
|
-
</template>
|
|
267
|
-
|
|
268
|
-
<style lang="scss" scoped></style>
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
#### Props
|
|
273
|
-
|
|
274
|
-
| 字段 | 说明 | 类型 | 默认值 |
|
|
275
|
-
|------------------|----------------------------------------|---------|-----------|
|
|
276
|
-
| open-page | 打开页面方法 | Function | |
|
|
277
|
-
| router-view-name | router view名称 | String | `default` |
|
|
278
|
-
| routes | 路由列表 | Route[] | |
|
|
279
|
-
| active-path | 激活路径 | String | |
|
|
280
|
-
| height | 导航容器高度 | Number | |
|
|
281
|
-
| width | 导航容器宽度 | Number | |
|
|
282
|
-
| drag | 是否支持拖曳 | Boolean | |
|
|
283
|
-
| swipe-duration | 滑动页面动画时间 | Number ||
|
|
284
|
-
| scroll-time | 切换页面动画时间 | Number | |
|
|
285
|
-
| move-ratio | 触发页面移动的比例(相对页面宽度) | Number | 0.5 |
|
|
286
|
-
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
## 插槽
|
|
291
|
-
|
|
292
|
-
| 名称 | 说明 |
|
|
293
|
-
|---------|------------------|
|
|
294
|
-
| default | 内容 |
|
|
1
|
+
# fox-navigation
|
|
2
|
+
|
|
3
|
+
导航组件,支持动画过渡
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### NPM
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm i @fox-js/navigation -S
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### YARN
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
yarn add @fox-js/navigation
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### PNPM
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
pnpm add @fox-js/navigation
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 使用说明
|
|
26
|
+
|
|
27
|
+
### fox-root-navigator
|
|
28
|
+
|
|
29
|
+
root导航组件,在入口vue文件(App.vue)上使用,支持新增页面的动画效果和拖曳关闭页面。
|
|
30
|
+
|
|
31
|
+
#### 基础用法
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { usePageHelper } from '@/utils/custom'
|
|
36
|
+
// 获取page helper
|
|
37
|
+
const pageHelper = usePageHelper()
|
|
38
|
+
// 定义remove page函数
|
|
39
|
+
const removePage = () => {
|
|
40
|
+
pageHelper.remove()
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<fox-root-navigator :remove-page="removePage"></fox-root-navigator>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style lang="scss">
|
|
49
|
+
</style>
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### 设置页面加载动画
|
|
54
|
+
|
|
55
|
+
##### 滑入方式
|
|
56
|
+
|
|
57
|
+
通过route的params属性设置animationType:'slide'
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { usePageHelper } from '@/utils/custom'
|
|
61
|
+
|
|
62
|
+
pageHelper.append({
|
|
63
|
+
path: target.route,
|
|
64
|
+
params: {
|
|
65
|
+
animationType:'slide'
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
##### 弹出方式
|
|
72
|
+
|
|
73
|
+
通过route的params属性设置animationType:'pop'
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { usePageHelper } from '@/utils/custom'
|
|
77
|
+
|
|
78
|
+
pageHelper.append({
|
|
79
|
+
path: target.route,
|
|
80
|
+
params: {
|
|
81
|
+
animationType:'pop'
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#### Props
|
|
89
|
+
|
|
90
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
91
|
+
|------------------|----------------------------------------|---------|-----------|
|
|
92
|
+
| drag-remove | 是否支持拖曳关闭 | Boolean | true |
|
|
93
|
+
| remove-page | 关闭顶层页面方法 | Function | |
|
|
94
|
+
| router-view-name | router view名称 | String | `default` |
|
|
95
|
+
| view-tag | view tag标签 | Function/String | `div` |
|
|
96
|
+
| remove-move-ratio | 触发移除页面的移动比例(相对页面宽度) | Number | 0.5 |
|
|
97
|
+
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## 插槽
|
|
102
|
+
|
|
103
|
+
| 名称 | 说明 |
|
|
104
|
+
|---------|------------------|
|
|
105
|
+
| default | 内容 |
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### fox-card-navigator
|
|
110
|
+
|
|
111
|
+
卡片导航组件,配合多标签页容器使用,具备缓存页面的能力。
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
#### 基础用法
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
const rootName = $ref('_tab_view')
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<template>
|
|
123
|
+
<fox-card-navigator
|
|
124
|
+
:router-view-name="rootName"
|
|
125
|
+
:transition="true"
|
|
126
|
+
></fox-card-navigator>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style lang="scss">
|
|
130
|
+
</style>
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Props
|
|
135
|
+
|
|
136
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
137
|
+
|------------------|----------------------------------------|---------|-----------|
|
|
138
|
+
| router-view-name | router view名称 | String | `default` |
|
|
139
|
+
| transition | 是否支持过渡动画 | Boolean | false |
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## 插槽
|
|
144
|
+
|
|
145
|
+
| 名称 | 说明 |
|
|
146
|
+
|---------|------------------|
|
|
147
|
+
| default | 内容 |
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### fox-swiper-navigator
|
|
151
|
+
|
|
152
|
+
swiper导航组件,配合tab标签使用(例如手机端的主界面),支持拖曳新打开新页面/切换页面
|
|
153
|
+
|
|
154
|
+
#### 基础用法
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
<script lang="ts" setup>
|
|
158
|
+
import { onMounted, ref, computed } from 'vue'
|
|
159
|
+
import { usePageHelper } from '@/utils/custom'
|
|
160
|
+
import store from '@/store'
|
|
161
|
+
import tabs from './data'
|
|
162
|
+
const contentPadding = {
|
|
163
|
+
left: 0,
|
|
164
|
+
top: 0,
|
|
165
|
+
right: 0,
|
|
166
|
+
bottom: 0
|
|
167
|
+
}
|
|
168
|
+
// -------------- 导航设置 ---------------
|
|
169
|
+
// content width/height
|
|
170
|
+
const contentWidth = ref(0)
|
|
171
|
+
const contentHeight = ref(0)
|
|
172
|
+
// page ref
|
|
173
|
+
const pageRef = ref(null)
|
|
174
|
+
// root name
|
|
175
|
+
const rootName = ref('_tab_view')
|
|
176
|
+
// routes
|
|
177
|
+
const routes = computed(() => {
|
|
178
|
+
return tabs.map(tab => {
|
|
179
|
+
return {
|
|
180
|
+
path: tab.route
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
// active route path
|
|
185
|
+
const activeRoutePath = computed({
|
|
186
|
+
set: (newVal: string) => {
|
|
187
|
+
// 更新tab bar的index
|
|
188
|
+
index.value = routes.value.findIndex(r => {
|
|
189
|
+
return r.path === newVal
|
|
190
|
+
})
|
|
191
|
+
store.setCurrentRoutePath(newVal, rootName.value)
|
|
192
|
+
},
|
|
193
|
+
get: (): string => {
|
|
194
|
+
return store.getCurrentRoutePath(rootName.value) as string
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
// open page
|
|
198
|
+
const openPage = (route: any, index: number) => {
|
|
199
|
+
onTabChange(index)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// -------------tab bar 设置 ------------------
|
|
203
|
+
//当前tab索引
|
|
204
|
+
const index = ref(0)
|
|
205
|
+
// 获取page helper
|
|
206
|
+
const pageHelper = usePageHelper()
|
|
207
|
+
// tab change事件
|
|
208
|
+
const onTabChange = (index: any) => {
|
|
209
|
+
const tab = tabs[index]
|
|
210
|
+
// open页面
|
|
211
|
+
pageHelper.open(tab.route)
|
|
212
|
+
// 当前的route path到公共store中
|
|
213
|
+
store.setCurrentRoutePath(tab.route, rootName.value)
|
|
214
|
+
}
|
|
215
|
+
// content应用
|
|
216
|
+
const contentRef = ref(null)
|
|
217
|
+
// 加载后处理
|
|
218
|
+
onMounted(() => {
|
|
219
|
+
if (pageRef.value) {
|
|
220
|
+
const anyPage: any = pageRef.value
|
|
221
|
+
contentWidth.value = anyPage.getPageContentWidth()
|
|
222
|
+
if (contentWidth.value === 0) {
|
|
223
|
+
const anyContent: any = contentRef.value
|
|
224
|
+
contentWidth.value = anyContent.$el.offsetWidth
|
|
225
|
+
}
|
|
226
|
+
contentHeight.value = anyPage.getPageContentHeight()
|
|
227
|
+
}
|
|
228
|
+
// 当前选中tab index
|
|
229
|
+
let curIndex = index.value
|
|
230
|
+
// 获取之前保存的route path
|
|
231
|
+
let path = store.getCurrentRoutePath(rootName.value)
|
|
232
|
+
if (path) {
|
|
233
|
+
let i = tabs.findIndex(tab => {
|
|
234
|
+
return tab.route === path
|
|
235
|
+
})
|
|
236
|
+
curIndex = i !== -1 ? i : curIndex
|
|
237
|
+
// 更新tab的model
|
|
238
|
+
index.value = curIndex
|
|
239
|
+
}
|
|
240
|
+
// 触发页面跳转
|
|
241
|
+
onTabChange(curIndex)
|
|
242
|
+
})
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<fox-page :content-padding="contentPadding" ref="pageRef">
|
|
247
|
+
<fox-footer-bar>
|
|
248
|
+
<fox-tabbar v-model="index" @change="onTabChange">
|
|
249
|
+
<template v-for="tab in tabs" :key="tab.title">
|
|
250
|
+
<fox-tabbar-item :title="tab.title" :icon="tab.icon"></fox-tabbar-item>
|
|
251
|
+
</template>
|
|
252
|
+
</fox-tabbar>
|
|
253
|
+
</fox-footer-bar>
|
|
254
|
+
<fox-content ref="contentRef">
|
|
255
|
+
<fox-swiper-navigator
|
|
256
|
+
v-model:activePath="activeRoutePath"
|
|
257
|
+
:router-view-name="rootName"
|
|
258
|
+
:routes="routes"
|
|
259
|
+
:open-page="openPage"
|
|
260
|
+
:transition="true"
|
|
261
|
+
:width="contentWidth"
|
|
262
|
+
:height="contentHeight"
|
|
263
|
+
></fox-swiper-navigator>
|
|
264
|
+
</fox-content>
|
|
265
|
+
</fox-page>
|
|
266
|
+
</template>
|
|
267
|
+
|
|
268
|
+
<style lang="scss" scoped></style>
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Props
|
|
273
|
+
|
|
274
|
+
| 字段 | 说明 | 类型 | 默认值 |
|
|
275
|
+
|------------------|----------------------------------------|---------|-----------|
|
|
276
|
+
| open-page | 打开页面方法 | Function | |
|
|
277
|
+
| router-view-name | router view名称 | String | `default` |
|
|
278
|
+
| routes | 路由列表 | Route[] | |
|
|
279
|
+
| active-path | 激活路径 | String | |
|
|
280
|
+
| height | 导航容器高度 | Number | |
|
|
281
|
+
| width | 导航容器宽度 | Number | |
|
|
282
|
+
| drag | 是否支持拖曳 | Boolean | |
|
|
283
|
+
| swipe-duration | 滑动页面动画时间 | Number ||
|
|
284
|
+
| scroll-time | 切换页面动画时间 | Number | |
|
|
285
|
+
| move-ratio | 触发页面移动的比例(相对页面宽度) | Number | 0.5 |
|
|
286
|
+
| momentum-reduce-ratio | 惯性削减比例 | Number | 1 |
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 插槽
|
|
291
|
+
|
|
292
|
+
| 名称 | 说明 |
|
|
293
|
+
|---------|------------------|
|
|
294
|
+
| default | 内容 |
|