Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihuizhen
ec-report-refactor
Commits
fab95a52
Commit
fab95a52
authored
Feb 21, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: datepicker config
parent
c91b002e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
DatePicker.vue
components/DatePicker/DatePicker.vue
+17
-2
common.js
utils/common.js
+0
-2
No files found.
components/DatePicker/DatePicker.vue
View file @
fab95a52
...
...
@@ -10,7 +10,7 @@
:select-open=
"show"
:border=
"true"
:borderColor=
"elementInfo.option.dateTime.borderColor"
:custom-style=
"
{ color: elementInfo.option.dateTime.color }"
:custom-style=
"
{ color: elementInfo.option.dateTime.color
, fontSize: `${elementInfo.option.dateTime.fontSize}px`
}"
@click="show = true"
>
</u-input>
<u-icon
...
...
@@ -61,7 +61,22 @@ export default {
}
},
mounted
()
{
let
{
date
}
=
this
.
elementInfo
.
option
.
dateTime
let
{
date
,
isDefault
,
defaultDate
}
=
this
.
elementInfo
.
option
.
dateTime
if
(
isDefault
)
{
const
today
=
new
Date
()
if
(
defaultDate
===
'today'
)
{
}
if
(
defaultDate
===
'yesterday'
)
{
const
timestamp
=
today
.
getTime
()
-
1000
*
24
*
60
*
60
today
.
setTime
(
timestamp
)
}
if
(
defaultDate
===
'week'
)
{
const
timestamp
=
today
.
getTime
()
-
1000
*
24
*
60
*
60
*
6
today
.
setTime
(
timestamp
)
}
this
.
pickerValue
=
this
.
dateTimeFormat
(
today
)
return
}
if
(
date
)
this
.
pickerValue
=
this
.
dateTimeFormat
(
date
)
},
methods
:
{
...
...
utils/common.js
View file @
fab95a52
...
...
@@ -158,7 +158,6 @@ const install = (Vue, vm) => {
const
day
=
()
=>
{
const
date
=
new
Date
();
const
day
=
date
.
getDate
()
<
10
?
"0"
+
date
.
getDate
()
:
date
.
getDate
();
return
day
}
...
...
@@ -177,7 +176,6 @@ const install = (Vue, vm) => {
const
date
=
new
Date
()
const
timestamp
=
date
.
getTime
()
-
1000
*
24
*
60
*
60
date
.
setTime
(
timestamp
)
console
.
log
(
date
)
const
year
=
date
.
getFullYear
();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
const
month
=
date
.
getMonth
()
+
1
<
10
?
"0"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment