Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoderSmallfan
uni-app
提交
be9f6386
U
uni-app
项目概览
CoderSmallfan
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be9f6386
编写于
12月 26, 2018
作者:
郭
郭胜强
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复picker组件多咧选择columnchange事件不触发的问题
build uni-h5 0.0.10
上级
cd711d40
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
136 addition
and
128 deletion
+136
-128
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-h5/package.json
packages/uni-h5/package.json
+1
-1
src/core/view/components/picker/index.vue
src/core/view/components/picker/index.vue
+7
-6
src/platforms/h5/components/app/popup/picker.vue
src/platforms/h5/components/app/popup/picker.vue
+127
-120
未找到文件。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
be9f6386
此差异已折叠。
点击以展开。
packages/uni-h5/package.json
浏览文件 @
be9f6386
{
"name"
:
"@dcloudio/uni-h5"
,
"version"
:
"0.0.
9
"
,
"version"
:
"0.0.
10
"
,
"description"
:
"uni-app h5"
,
"main"
:
"dist/index.umd.min.js"
,
"scripts"
:
{
...
...
src/core/view/components/picker/index.vue
浏览文件 @
be9f6386
<
template
>
<uni-picker
@
click.stop=
"_click"
>
<div>
<slot
/>
<slot/>
</div>
</uni-picker>
</
template
>
...
...
@@ -176,7 +176,7 @@ export default {
}
const
id
=
this
.
$page
.
id
subscribe
(
`
${
id
}
-picker-change`
,
this
.
change
)
//
subscribe(`${id}-picker-columnchange`, this.columnchange)
subscribe
(
`
${
id
}
-picker-columnchange`
,
this
.
columnchange
)
subscribe
(
`
${
id
}
-picker-cancel`
,
this
.
cancel
)
this
.
visible
=
true
this
.
_show
()
...
...
@@ -193,7 +193,7 @@ export default {
this
.
visible
=
false
const
id
=
this
.
$page
.
id
unsubscribe
(
`
${
id
}
-picker-change`
)
//
unsubscribe(`${id}-picker-columnchange`)
unsubscribe
(
`
${
id
}
-picker-columnchange`
)
unsubscribe
(
`
${
id
}
-picker-cancel`
)
if
(
!
this
.
disabled
)
{
this
.
valueChangeSource
=
'
click
'
...
...
@@ -204,13 +204,14 @@ export default {
})
}
},
// columnchange (args) {
// },
columnchange
(
args
)
{
this
.
$trigger
(
'
change
'
,
{},
args
)
},
cancel
(
args
)
{
this
.
visible
=
false
const
id
=
this
.
$page
.
id
unsubscribe
(
`
${
id
}
-picker-change`
)
//
unsubscribe(`${id}-picker-columnchange`)
unsubscribe
(
`
${
id
}
-picker-columnchange`
)
unsubscribe
(
`
${
id
}
-picker-cancel`
)
this
.
$trigger
(
'
cancel
'
,
{},
{})
},
...
...
src/platforms/h5/components/app/popup/picker.vue
浏览文件 @
be9f6386
<
template
>
<uni-picker
@
touchmove.prevent
>
<transition
name=
"uni-fade"
>
<div
v-show=
"visible"
class=
"uni-mask"
@
click=
"_cancel"
/>
<div
v-show=
"visible"
class=
"uni-mask"
@
click=
"_cancel"
/>
</transition>
<div
:class=
"
{'uni-picker-toggle':visible}"
<div
:class=
"
{'uni-picker-toggle':visible}"
class="uni-picker">
<div
class=
"uni-picker-header"
<div
class=
"uni-picker-header"
@
click.stop
>
<div
class=
"uni-picker-action uni-picker-action-cancel"
<div
class=
"uni-picker-action uni-picker-action-cancel"
@
click=
"_cancel"
>
取消
</div>
<div
class=
"uni-picker-action uni-picker-action-confirm"
<div
class=
"uni-picker-action uni-picker-action-confirm"
@
click=
"_change"
>
确定
</div>
</div>
<v-uni-picker-view
v-if=
"visible"
:value.sync=
"valueArray"
<v-uni-picker-view
v-if=
"visible"
:value.sync=
"valueArray"
class=
"uni-picker-content"
>
<v-uni-picker-view-column
v-for=
"(range,index0) in rangeArray"
<v-uni-picker-view-column
v-for=
"(range,index0) in rangeArray"
:key=
"index0"
>
<div
v-for=
"(item,index) in range"
:key=
"index"
class=
"uni-picker-item"
>
{{
typeof
item
===
'
object
'
?
item
[
rangeKey
]
||
''
:
item
}}{{
units
[
index0
]
||
''
}}
</div>
class=
"uni-picker-item"
>
{{
typeof
item
===
'
object
'
?
item
[
rangeKey
]
||
''
:
item
}}{{
units
[
index0
]
||
''
}}
</div>
</v-uni-picker-view-column>
</v-uni-picker-view>
<!-- 第二种时间单位展示方式-暂时不用这种 -->
<!--
<div
v-if=
"units.length"
class=
"uni-picker-units"
>
<div
v-for=
"(item,index) in units"
:key=
"index"
>
{{
item
}}
</div>
</div>
-->
</div>
-->
</div>
</uni-picker>
</
template
>
...
...
@@ -142,7 +143,8 @@ export default {
return
{
timeArray
:
[],
dateArray
:
[],
valueArray
:
[]
valueArray
:
[],
oldValueArray
:
[]
}
},
computed
:
{
...
...
@@ -213,6 +215,18 @@ export default {
this
.
_cloneArray
(
valueArray
,
endArray
)
}
}
val
.
forEach
((
value
,
column
)
=>
{
if
(
value
!==
this
.
oldValueArray
[
column
])
{
this
.
oldValueArray
[
column
]
=
value
if
(
this
.
mode
===
mode
.
MULTISELECTOR
)
{
// 触发 View 层 columnchange 事件
UniServiceJSBridge
.
publishHandler
(
this
.
pageId
+
'
-picker-columnchange
'
,
{
column
,
value
},
this
.
pageId
)
}
}
})
}
},
created
()
{
...
...
@@ -295,7 +309,8 @@ export default {
valueArray
=
val
.
split
(
'
-
'
).
map
((
val
,
i
)
=>
this
.
dateArray
[
i
].
indexOf
(
val
))
break
}
this
.
valueArray
=
valueArray
this
.
oldValueArray
=
[...
valueArray
]
this
.
valueArray
=
[...
valueArray
]
},
_getValue
()
{
var
val
=
this
.
valueArray
...
...
@@ -317,14 +332,6 @@ export default {
value
:
this
.
_getValue
()
},
this
.
pageId
)
},
// 暂时取消 columnchange 事件
// _columnchange (event) {
// // 触发 View 层 columnchange 事件
// UniServiceJSBridge.publishHandler(this.pageId + '-picker-columnchange', {
// column: 0,
// value: this._getValue()
// }, this.pageId)
// },
_cancel
()
{
// 通知父组件修改 visible
this
.
$emit
(
'
close
'
)
...
...
@@ -335,109 +342,109 @@ export default {
}
</
script
>
<
style
>
uni-picker
{
display
:
block
;
box-sizing
:
border-box
;
}
uni-picker
{
display
:
block
;
box-sizing
:
border-box
;
}
uni-picker
.uni-picker
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
transform
:
translate
(
0
,
100%
);
backface-visibility
:
hidden
;
z-index
:
999
;
width
:
100%
;
background-color
:
#efeff4
;
transition
:
transform
0.3s
;
}
uni-picker
.uni-picker
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
transform
:
translate
(
0
,
100%
);
backface-visibility
:
hidden
;
z-index
:
999
;
width
:
100%
;
background-color
:
#efeff4
;
transition
:
transform
0.3s
;
}
uni-picker
.uni-picker.uni-picker-toggle
{
transform
:
translate
(
0
,
0
);
}
uni-picker
.uni-picker.uni-picker-toggle
{
transform
:
translate
(
0
,
0
);
}
uni-picker
.uni-picker
*
{
box-sizing
:
border-box
;
}
uni-picker
.uni-picker
*
{
box-sizing
:
border-box
;
}
uni-picker
.uni-picker
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
transform
:
translate
(
0
,
100%
);
backface-visibility
:
hidden
;
z-index
:
999
;
width
:
100%
;
background-color
:
#efeff4
;
transition
:
transform
0.3s
;
transition
:
transform
0.3s
;
}
uni-picker
.uni-picker
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
transform
:
translate
(
0
,
100%
);
backface-visibility
:
hidden
;
z-index
:
999
;
width
:
100%
;
background-color
:
#efeff4
;
transition
:
transform
0.3s
;
transition
:
transform
0.3s
;
}
uni-picker
.uni-picker-content
{
position
:
relative
;
display
:
block
;
width
:
100%
;
height
:
238px
;
background-color
:
white
;
}
uni-picker
.uni-picker-content
{
position
:
relative
;
display
:
block
;
width
:
100%
;
height
:
238px
;
background-color
:
white
;
}
uni-picker
.uni-picker-item
{
padding
:
0
;
height
:
34px
;
line-height
:
34px
;
text-align
:
center
;
color
:
#000
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
}
uni-picker
.uni-picker-item
{
padding
:
0
;
height
:
34px
;
line-height
:
34px
;
text-align
:
center
;
color
:
#000
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
}
uni-picker
.uni-picker-header
{
display
:
block
;
position
:
relative
;
text-align
:
center
;
width
:
100%
;
height
:
45px
;
background-color
:
#fff
;
}
uni-picker
.uni-picker-header
{
display
:
block
;
position
:
relative
;
text-align
:
center
;
width
:
100%
;
height
:
45px
;
background-color
:
#fff
;
}
uni-picker
.uni-picker-header
:after
{
content
:
""
;
position
:
absolute
;
left
:
0
;
bottom
:
0
;
right
:
0
;
height
:
1px
;
clear
:
both
;
border-bottom
:
1px
solid
#e5e5e5
;
color
:
#e5e5e5
;
transform-origin
:
0
100%
;
transform
:
scaleY
(
0.5
);
}
uni-picker
.uni-picker-header
:after
{
content
:
""
;
position
:
absolute
;
left
:
0
;
bottom
:
0
;
right
:
0
;
height
:
1px
;
clear
:
both
;
border-bottom
:
1px
solid
#e5e5e5
;
color
:
#e5e5e5
;
transform-origin
:
0
100%
;
transform
:
scaleY
(
0.5
);
}
uni-picker
.uni-picker-action
{
display
:
block
;
max-width
:
50%
;
top
:
0
;
height
:
100%
;
box-sizing
:
border-box
;
padding
:
0
14px
;
font-size
:
17px
;
line-height
:
45px
;
overflow
:
hidden
;
}
uni-picker
.uni-picker-action
{
display
:
block
;
max-width
:
50%
;
top
:
0
;
height
:
100%
;
box-sizing
:
border-box
;
padding
:
0
14px
;
font-size
:
17px
;
line-height
:
45px
;
overflow
:
hidden
;
}
uni-picker
.uni-picker-action.uni-picker-action-cancel
{
float
:
left
;
color
:
#888
;
}
uni-picker
.uni-picker-action.uni-picker-action-cancel
{
float
:
left
;
color
:
#888
;
}
uni-picker
.uni-picker-action.uni-picker-action-confirm
{
float
:
right
;
color
:
#007aff
;
}
uni-picker
.uni-picker-action.uni-picker-action-confirm
{
float
:
right
;
color
:
#007aff
;
}
/* .uni-picker {
/* .uni-picker {
position: relative;
}
.uni-picker-units {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录