Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
京东前端
nutui
提交
32af1d32
N
nutui
项目概览
京东前端
/
nutui
通知
37
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nutui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
32af1d32
编写于
9月 27, 2020
作者:
xiaozhumaopao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: update tabbar
上级
58c7af55
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
3 deletion
+8
-3
src/packages/tabbar/doc.md
src/packages/tabbar/doc.md
+2
-1
src/packages/tabbar/tabbar.vue
src/packages/tabbar/tabbar.vue
+6
-2
未找到文件。
src/packages/tabbar/doc.md
浏览文件 @
32af1d32
...
...
@@ -68,7 +68,7 @@ export default {
**重要提示**
组件中的 curr 属性相当于默认的选中tab,如果tabbar组件被应用于跳转路由,若tabbar没有按照预想的选中高亮的话,请注意,一般是因为重新渲染了tabbar组件导致的,解决方法如下:
组件中的 curr 属性相当于默认的选中tab,如果tabbar组件被应用于跳转路由,
设置 isRouter = true ,
若tabbar没有按照预想的选中高亮的话,请注意,一般是因为重新渲染了tabbar组件导致的,解决方法如下:
-
方法1、通过监听切换事件 @tab-switch 改变传入数据 tabList 中想要高亮对象的 curr 值为 true;
-
方法2、把 tabbar 组件放在路由层级之外,令其独立出来,避免点击 tabbar 会重新渲染该组件;
...
...
@@ -83,6 +83,7 @@ export default {
| tabbar-list | 渲染数据 | Array | []
| bottom | 是否固定在页面底部 |Boolean|false|
| replace | replace为true的时候,跳转url以替换的形式进行 |Boolean|false|
| isRouter | 是否为vue路由跳转形式,区别于H5的web跳转|Boolean|false|
### tabbar-list
...
...
src/packages/tabbar/tabbar.vue
浏览文件 @
32af1d32
...
...
@@ -40,6 +40,10 @@ export default {
type
:
Boolean
,
default
:
false
,
},
isRouter
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
...
...
@@ -71,10 +75,10 @@ export default {
this
.
currIndex
=
index
;
if
(
this
.
replace
)
{
//替换url
window
.
location
.
replace
(
value
.
href
);
this
.
isRouter
?
this
.
$router
.
replace
(
value
.
href
)
:
window
.
location
.
replace
(
value
.
href
);
}
else
{
if
(
value
.
href
)
{
window
.
location
.
href
=
value
.
href
;
this
.
isRouter
?
this
.
$router
.
push
(
value
.
href
)
:
(
window
.
location
.
href
=
value
.
href
)
;
}
}
this
.
$emit
(
'
tab-switch
'
,
value
,
index
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录