Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
Project
Project
Details
Activity
Releases
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
easyUI
hls-easy-ui
Commits
81d87ab4
Commit
81d87ab4
authored
Feb 21, 2020
by
JingChao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keyboard
parent
a28539fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
135 additions
and
130 deletions
+135
-130
index.vue
packages/components/NumberKeyboard/index.vue
+135
-130
No files found.
packages/components/NumberKeyboard/index.vue
View file @
81d87ab4
...
...
@@ -223,149 +223,154 @@
</
style
>
<
script
>
import
Key
from
'./key'
import
Key
from
'./key'
export
default
{
name
:
'NumberKeyboard'
,
components
:
{
Key
},
props
:
{
show
:
Boolean
,
// eslint-disable-line
title
:
String
,
// eslint-disable-line
closeButtonText
:
String
,
// eslint-disable-line
theme
:
{
type
:
String
,
default
:
'default'
,
export
default
{
name
:
'NumberKeyboard'
,
components
:
{
Key
},
props
:
{
show
:
Boolean
,
// eslint-disable-line
title
:
String
,
// eslint-disable-line
closeButtonText
:
String
,
// eslint-disable-line
theme
:
{
type
:
String
,
default
:
'default'
,
},
extraKey
:
{
type
:
String
,
default
:
''
,
},
zIndex
:
{
type
:
Number
,
default
:
100
,
},
transition
:
{
type
:
Boolean
,
default
:
true
,
},
showDeleteKey
:
{
type
:
Boolean
,
default
:
true
,
},
hideOnClickOutside
:
{
type
:
Boolean
,
default
:
true
,
},
cusClass
:
{
type
:
String
,
default
:
''
,
},
},
extraKey
:
{
type
:
String
,
default
:
''
,
},
zIndex
:
{
type
:
Number
,
default
:
100
,
},
transition
:
{
type
:
Boolean
,
default
:
true
,
},
showDeleteKey
:
{
type
:
Boolean
,
default
:
true
,
},
hideOnClickOutside
:
{
type
:
Boolean
,
default
:
true
,
},
cusClass
:
{
type
:
String
,
default
:
''
,
},
},
data
()
{
return
{
keyBoardPlugin
:
false
,
}
},
computed
:
{
keys
()
{
const
keys
=
[]
for
(
let
i
=
1
;
i
<=
9
;
i
++
)
{
keys
.
push
({
text
:
i
})
}
keys
.
push
(
{
text
:
this
.
extraKey
,
type
:
'gray'
},
{
text
:
0
},
{
text
:
'delete'
,
type
:
'delete gray'
}
)
return
keys
},
style
()
{
data
()
{
return
{
zIndex
:
this
.
zIndex
,
keyBoardPlugin
:
false
,
}
},
showTitleClose
()
{
return
this
.
closeButtonText
&&
this
.
theme
===
'default'
},
},
watch
:
{
show
()
{
if
(
!
this
.
transition
)
{
this
.
$emit
(
this
.
show
?
'show'
:
'hide'
)
}
computed
:
{
keys
()
{
const
keys
=
[]
for
(
let
i
=
1
;
i
<=
9
;
i
++
)
{
keys
.
push
({
text
:
i
})
}
keys
.
push
(
{
text
:
this
.
extraKey
,
type
:
'gray'
},
{
text
:
0
},
{
text
:
'delete'
,
type
:
'delete gray'
}
)
return
keys
},
style
()
{
return
{
zIndex
:
this
.
zIndex
,
}
},
showTitleClose
()
{
return
this
.
closeButtonText
&&
this
.
theme
===
'default'
},
},
},
mounted
()
{
this
.
handler
(
true
)
this
.
$el
.
setAttribute
(
'vum-show-keyborad'
,
''
)
},
destroyed
()
{
this
.
handler
(
false
)
if
(
this
.
keyBoardPlugin
)
{
document
.
body
.
removeChild
(
this
.
$el
)
}
},
activated
()
{
this
.
handler
(
true
)
},
deactivated
()
{
this
.
handler
(
false
)
},
methods
:
{
closeKeyboard
()
{
let
vm
=
this
this
.
show
=
false
let
wrapper
=
document
.
querySelector
(
'[vum-show-keyborad]'
)
if
(
wrapper
&&
vm
.
keyBoardPlugin
)
{
document
.
body
.
removeChild
(
wrapper
)
}
watch
:
{
show
()
{
if
(
!
this
.
transition
)
{
this
.
$emit
(
this
.
show
?
'show'
:
'hide'
)
}
},
},
showNumberKeyboard
(
options
)
{
this
.
keyBoardPlugin
=
true
this
.
title
=
options
.
title
this
.
closeButtonText
=
options
.
closeButtonText
this
.
extraKey
=
options
.
extraKey
this
.
keyDown
=
options
.
keyDown
this
.
keyDelete
=
options
.
keyDelete
this
.
show
=
true
mounted
()
{
this
.
handler
(
true
)
this
.
$el
.
setAttribute
(
'vum-show-keyborad'
,
''
)
},
handler
(
action
)
{
if
(
action
!==
this
.
handlerStatus
&&
this
.
hideOnClickOutside
)
{
this
.
handlerStatus
=
action
document
.
body
[(
action
?
'add'
:
'remove'
)
+
'EventListener'
](
'touchstart'
,
this
.
onBlur
)
destroyed
(
)
{
this
.
handler
(
false
)
if
(
this
.
keyBoardPlugin
)
{
document
.
body
.
removeChild
(
this
.
$el
)
}
},
onBlur
()
{
this
.
$emit
(
'blur'
)
},
onClose
()
{
this
.
$emit
(
'close'
)
this
.
show
=
false
this
.
onBlur
()
activated
()
{
this
.
handler
(
true
)
},
onAnimationEn
d
()
{
this
.
$emit
(
this
.
show
?
'show'
:
'hide'
)
deactivate
d
()
{
this
.
handler
(
false
)
},
onPressKey
(
text
)
{
let
vm
=
this
if
(
text
===
''
)
{
return
}
if
(
text
===
'delete'
)
{
this
.
$emit
(
'delete'
)
if
(
vm
.
keyDelete
)
{
vm
.
keyDelete
()
methods
:
{
closeKeyboard
()
{
let
vm
=
this
let
wrapper
=
document
.
querySelector
(
'[vum-show-keyborad]'
)
if
(
wrapper
&&
vm
.
keyBoardPlugin
)
{
this
.
show
=
false
try
{
document
.
body
.
removeChild
(
wrapper
)
}
catch
(
e
)
{
}
}
else
if
(
vm
.
keyBoardPlugin
===
false
&&
vm
.
hideOnClickOutside
)
{
this
.
onClose
()
}
}
else
if
(
text
===
this
.
closeButtonText
)
{
this
.
onClose
()
}
else
{
this
.
$emit
(
'input'
,
text
)
if
(
vm
.
keyDown
)
{
vm
.
keyDown
(
text
)
},
showNumberKeyboard
(
options
)
{
this
.
keyBoardPlugin
=
true
this
.
title
=
options
.
title
this
.
closeButtonText
=
options
.
closeButtonText
this
.
extraKey
=
options
.
extraKey
this
.
keyDown
=
options
.
keyDown
this
.
keyDelete
=
options
.
keyDelete
this
.
show
=
true
},
handler
(
action
)
{
if
(
action
!==
this
.
handlerStatus
&&
this
.
hideOnClickOutside
)
{
this
.
handlerStatus
=
action
document
.
body
[(
action
?
'add'
:
'remove'
)
+
'EventListener'
](
'touchstart'
,
this
.
onBlur
)
}
}
},
onBlur
()
{
this
.
$emit
(
'blur'
)
},
onClose
()
{
this
.
$emit
(
'close'
)
this
.
show
=
false
this
.
onBlur
()
},
onAnimationEnd
()
{
this
.
$emit
(
this
.
show
?
'show'
:
'hide'
)
},
onPressKey
(
text
)
{
let
vm
=
this
if
(
text
===
''
)
{
return
}
if
(
text
===
'delete'
)
{
this
.
$emit
(
'delete'
)
if
(
vm
.
keyDelete
)
{
vm
.
keyDelete
()
}
}
else
if
(
text
===
this
.
closeButtonText
)
{
this
.
onClose
()
}
else
{
this
.
$emit
(
'input'
,
text
)
if
(
vm
.
keyDown
)
{
vm
.
keyDown
(
text
)
}
}
},
},
},
}
}
</
script
>
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