Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
cube-ui
提交
38c4b0c6
C
cube-ui
项目概览
DiDi
/
cube-ui
11 个月 前同步成功
通知
34
Star
9078
Fork
1508
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cube-ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38c4b0c6
编写于
1月 03, 2018
作者:
D
dolymood
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:didi/cube-ui into dev
# Conflicts: # src/components/scroll/scroll.vue
上级
963ea5fc
cc5697f7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
46 addition
and
41 deletion
+46
-41
document/components/docs/en-US/scroll.md
document/components/docs/en-US/scroll.md
+1
-1
document/components/docs/en-US/theme.md
document/components/docs/en-US/theme.md
+0
-3
document/components/docs/zh-CN/scroll.md
document/components/docs/zh-CN/scroll.md
+1
-1
document/components/docs/zh-CN/theme.md
document/components/docs/zh-CN/theme.md
+0
-3
src/common/stylus/theme/default.styl
src/common/stylus/theme/default.styl
+0
-3
src/components/index-list/index-list.vue
src/components/index-list/index-list.vue
+8
-4
src/components/scroll/scroll.vue
src/components/scroll/scroll.vue
+36
-26
未找到文件。
document/components/docs/en-US/scroll.md
浏览文件 @
38c4b0c6
...
...
@@ -201,7 +201,7 @@
| Attribute | Description | Type | Accepted Values | Default |
| - | - | - | - | - |
| threshold | the threshold of distance that pulling up for loading | Number | - | 0 |
| txt | the text shown when pulling up loading | Object | - | { more: '
Load more', noMore: 'No more data
' } |
| txt | the text shown when pulling up loading | Object | - | { more: '
', noMore: '
' } |
### Slot
...
...
document/components/docs/en-US/theme.md
浏览文件 @
38c4b0c6
...
...
@@ -111,9 +111,6 @@ $picker-item-color := $color-dark-grey
$popup-mask-bgc := rgb(37, 38, 45)
$popup-mask-opacity := .4
// scroll
$scroll-content-bgc := $color-white
// slide
$slide-dot-bgc := $color-light-grey-s
$slide-dot-active-bgc := $color-orange
...
...
document/components/docs/zh-CN/scroll.md
浏览文件 @
38c4b0c6
...
...
@@ -201,7 +201,7 @@
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
| - | - | - | - | - |
| threshold | 上拉刷新动作的上拉距离阈值 | Number | - | 0 |
| txt | 上拉加载的相关文案 | Object | - | { more: '
Load more', noMore: 'No more data
' } |
| txt | 上拉加载的相关文案 | Object | - | { more: '
', noMore: '
' } |
### 插槽
...
...
document/components/docs/zh-CN/theme.md
浏览文件 @
38c4b0c6
...
...
@@ -111,9 +111,6 @@ $picker-item-color := $color-dark-grey
$popup-mask-bgc := rgb(37, 38, 45)
$popup-mask-opacity := .4
// scroll
$scroll-content-bgc := $color-white
// slide
$slide-dot-bgc := $color-light-grey-s
$slide-dot-active-bgc := $color-orange
...
...
src/common/stylus/theme/default.styl
浏览文件 @
38c4b0c6
...
...
@@ -103,9 +103,6 @@ $picker-item-color := $color-dark-grey
$popup-mask-bgc := rgb(37, 38, 45)
$popup-mask-opacity := .4
// scroll
$scroll-content-bgc := $color-white
// slide
$slide-dot-bgc := $color-light-grey-s
$slide-dot-active-bgc := $color-orange
...
...
src/components/index-list/index-list.vue
浏览文件 @
38c4b0c6
...
...
@@ -8,7 +8,7 @@
@
scroll=
"scroll"
>
<div
class=
"cube-index-list-content"
ref=
"content"
>
<h1
class=
"cube-index-list-title"
v-if=
"title"
ref=
"title"
@
click=
"titleClick"
>
{{
title
}}
{{
title
}}
</h1>
<ul>
<slot>
...
...
@@ -19,12 +19,16 @@
</div>
</cube-scroll>
<div
class=
"cube-index-list-nav"
@
touchstart=
"onShortcutTouchStart"
@
touchmove.stop.prevent=
"onShortcutTouchMove"
>
<ul>
<li
v-for=
"(item, index) in shortcutList"
:data-index=
"index"
:class=
"
{active: currentIndex === index}">
{{
item
}}
</li>
<ul
class=
"cube-index-list-nav-list"
>
<li
v-for=
"(item, index) in shortcutList"
:data-index=
"index"
class=
"cube-index-list-nav-item"
:class=
"
{active: currentIndex === index}">
{{
item
}}
</li>
</ul>
</div>
<div
class=
"cube-index-list-fixed cube-index-list-anchor"
ref=
"fixed"
v-show=
"fixedTitle"
>
{{
fixedTitle
}}
{{
fixedTitle
}}
</div>
</div>
</
template
>
...
...
src/components/scroll/scroll.vue
浏览文件 @
38c4b0c6
<
template
>
<div
ref=
"wrapper"
class=
"cube-scroll-wrapper"
>
<div
ref=
"listWrapper"
class=
"cube-scroll-content"
>
<slot>
<ul
class=
"cube-scroll-list"
>
<li
@
click=
"clickItem(item)"
class=
"cube-scroll-item border-bottom-1px"
v-for=
"item in data"
>
{{
item
}}
</li>
</ul>
<div
class=
"cube-scroll-content"
>
<div
ref=
"listWrapper"
class=
"cube-scroll-list-wrapper"
>
<slot>
<ul
class=
"cube-scroll-list"
>
<li
@
click=
"clickItem(item)"
class=
"cube-scroll-item border-bottom-1px"
v-for=
"item in data"
>
{{
item
}}
</li>
</ul>
</slot>
</div>
<slot
name=
"pullup"
:pullUpLoad=
"pullUpLoad"
:isPullUpLoad=
"isPullUpLoad"
>
<div
class=
"cube-pullup-wrapper"
v-if=
"pullUpLoad"
>
<div
class=
"before-trigger"
v-if=
"!isPullUpLoad && pullUpTxt"
>
<span>
{{
pullUpTxt
}}
</span>
</div>
<div
class=
"after-trigger"
v-if=
"isPullUpLoad"
>
<loading></loading>
</div>
</div>
</slot>
</div>
<slot
...
...
@@ -26,11 +38,6 @@
</div>
</div>
</slot>
<slot
name=
"pullup"
:pullUpLoad=
"pullUpLoad"
:isPullUpLoad=
"isPullUpLoad"
>
<div
v-if=
"pullUpLoad && isPullUpLoad"
class=
"cube-pullup-wrapper"
:style=
"pullUpStyle"
>
<loading></loading>
</div>
</slot>
</div>
</
template
>
...
...
@@ -43,8 +50,6 @@
const
COMPONENT_NAME
=
'
cube-scroll
'
const
DIRECTION_H
=
'
horizontal
'
const
DIRECTION_V
=
'
vertical
'
const
DEFAULT_LOAD_TXT_MORE
=
'
Load more
'
const
DEFAULT_LOAD_TXT_NO_MORE
=
'
No more data
'
const
DEFAULT_REFRESH_TXT
=
'
Refresh success
'
const
EVENT_SCROLL
=
'
scroll
'
...
...
@@ -106,8 +111,7 @@
isPullUpLoad
:
false
,
pullUpDirty
:
true
,
bubbleY
:
0
,
pullDownStyle
:
''
,
pullUpStyle
:
''
pullDownStyle
:
''
}
},
computed
:
{
...
...
@@ -120,8 +124,8 @@
pullUpTxt
()
{
const
pullUpLoad
=
this
.
pullUpLoad
const
txt
=
pullUpLoad
&&
pullUpLoad
.
txt
const
moreTxt
=
txt
&&
txt
.
more
||
DEFAULT_LOAD_TXT_MORE
const
noMoreTxt
=
txt
&&
txt
.
noMore
||
DEFAULT_LOAD_TXT_NO_MORE
const
moreTxt
=
txt
&&
txt
.
more
||
''
const
noMoreTxt
=
txt
&&
txt
.
noMore
||
''
return
this
.
pullUpDirty
?
moreTxt
:
noMoreTxt
},
...
...
@@ -143,9 +147,7 @@
if
(
!
this
.
$refs
.
wrapper
)
{
return
}
if
(
this
.
$refs
.
listWrapper
&&
(
this
.
pullDownRefresh
||
this
.
pullUpLoad
))
{
this
.
$refs
.
listWrapper
.
style
.
minHeight
=
`
${
getRect
(
this
.
$refs
.
wrapper
).
height
+
1
}
px`
}
this
.
_calculateMinHeight
()
let
options
=
Object
.
assign
({},
DEFAULT_OPTIONS
,
{
scrollY
:
this
.
direction
===
DIRECTION_V
,
...
...
@@ -181,6 +183,7 @@
this
.
scroll
&&
this
.
scroll
.
enable
()
},
refresh
()
{
this
.
_calculateMinHeight
()
this
.
scroll
&&
this
.
scroll
.
refresh
()
},
destroy
()
{
...
...
@@ -210,6 +213,11 @@
this
.
refresh
()
}
},
_calculateMinHeight
()
{
if
(
this
.
$refs
.
listWrapper
&&
(
this
.
pullDownRefresh
||
this
.
pullUpLoad
))
{
this
.
$refs
.
listWrapper
.
style
.
minHeight
=
`
${
getRect
(
this
.
$refs
.
wrapper
).
height
+
1
}
px`
}
},
_initPullDownRefresh
()
{
this
.
scroll
.
on
(
'
pullingDown
'
,
()
=>
{
this
.
beforePullDown
=
false
...
...
@@ -232,10 +240,6 @@
this
.
isPullUpLoad
=
true
this
.
$emit
(
EVENT_PULLING_UP
)
})
this
.
scroll
.
on
(
'
scroll
'
,
(
pos
)
=>
{
this
.
pullUpStyle
=
`bottom:
${
Math
.
min
(
this
.
scroll
.
maxScrollY
-
pos
.
y
-
50
)}
px`
})
},
_reboundPullDown
()
{
const
{
stopTime
=
600
}
=
this
.
pullDownRefresh
...
...
@@ -262,6 +266,11 @@
setTimeout
(()
=>
{
this
.
forceUpdate
(
true
)
},
this
.
refreshDelay
)
},
isPullUpLoad
()
{
this
.
$nextTick
(()
=>
{
this
.
scroll
.
refresh
()
})
}
},
components
:
{
...
...
@@ -293,13 +302,14 @@
margin-top: 5px
.cube-pullup-wrapper
position: absolute
width: 100%
left: 0
display: flex
justify-content: center
align-items: center
height: 50px
.before-trigger
padding: 22px 0
.after-trigger
padding: 18px 0
.cube-scroll-content
position: relative
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录