Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-12-08 10:05:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
475856dfe9a5b5fce5a282bec8eb1387383ee65e
475856df
1 parent
ddef268f
临时处理日期选择控件format问题
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletions
src/components/vant-weapp/datetime-picker/index.js
src/components/vant-weapp/datetime-picker/index.js
View file @
475856d
...
...
@@ -102,6 +102,25 @@ VantComponent({
if
(
defaultFormatter
)
{
formatter
=
defaultFormatter
;
}
// 默认写死配置
formatter
=
(
type
,
value
)
=>
{
if
(
type
===
'year'
)
{
return
`
${
value
}
年`
;
}
if
(
type
===
'month'
)
{
return
`
${
value
}
月`
;
}
if
(
type
===
'day'
)
{
return
`
${
value
}
日`
;
}
if
(
type
===
'hour'
)
{
return
`
${
value
}
时`
;
}
if
(
type
===
'minute'
)
{
return
`
${
value
}
分`
;
}
return
value
;
}
const
results
=
this
.
getOriginColumns
().
map
((
column
)
=>
({
values
:
column
.
values
.
map
((
value
)
=>
formatter
(
column
.
type
,
value
)),
}));
...
...
@@ -266,7 +285,26 @@ VantComponent({
updateColumnValue
(
value
)
{
let
values
=
[];
const
{
type
}
=
this
.
data
;
const
formatter
=
this
.
data
.
formatter
||
defaultFormatter
;
let
formatter
=
this
.
data
.
formatter
||
defaultFormatter
;
// 默认写死配置
formatter
=
(
type
,
value
)
=>
{
if
(
type
===
'year'
)
{
return
`
${
value
}
年`
;
}
if
(
type
===
'month'
)
{
return
`
${
value
}
月`
;
}
if
(
type
===
'day'
)
{
return
`
${
value
}
日`
;
}
if
(
type
===
'hour'
)
{
return
`
${
value
}
时`
;
}
if
(
type
===
'minute'
)
{
return
`
${
value
}
分`
;
}
return
value
;
}
const
picker
=
this
.
getPicker
();
if
(
type
===
'time'
)
{
const
pair
=
value
.
split
(
':'
);
...
...
Please
register
or
login
to post a comment