Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mui
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
mui
Commits
81a372e1
Commit
81a372e1
authored
Nov 23, 2014
by
hbcui1984
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决hello mui首页连按两次back键无法退出App的问题
parent
9ba90bbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
examples/hello-mui/index.html
examples/hello-mui/index.html
+0
-18
examples/hello-mui/list.html
examples/hello-mui/list.html
+17
-0
No files found.
examples/hello-mui/index.html
View file @
81a372e1
...
@@ -47,24 +47,6 @@
...
@@ -47,24 +47,6 @@
var
menu
=
null
,
showMenu
=
false
;
var
menu
=
null
,
showMenu
=
false
;
mui
.
plusReady
(
function
()
{
mui
.
plusReady
(
function
()
{
//首页返回键处理
//处理逻辑:1秒内,连续两次按返回键,则退出应用;
var
first
=
null
;
plus
.
key
.
addEventListener
(
'
backbutton
'
,
function
(){
//首次按键,提示‘再按一次退出应用’
if
(
!
first
){
first
=
new
Date
().
getTime
();
mui
.
toast
(
'
再按一次退出应用
'
);
setTimeout
(
function
(){
first
=
null
;
},
1000
);
}
else
{
if
(
new
Date
().
getTime
()
-
first
<
1000
){
plus
.
runtime
.
quit
();
}
}
},
false
);
//处理侧滑导航,为了避免和子页面初始化等竞争资源,延迟加载侧滑页面;
//处理侧滑导航,为了避免和子页面初始化等竞争资源,延迟加载侧滑页面;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
menu
=
mui
.
preload
({
menu
=
mui
.
preload
({
...
...
examples/hello-mui/list.html
View file @
81a372e1
...
@@ -472,6 +472,23 @@
...
@@ -472,6 +472,23 @@
});
});
$
.
plusReady
(
function
()
{
$
.
plusReady
(
function
()
{
plus
.
navigator
.
closeSplashscreen
();
plus
.
navigator
.
closeSplashscreen
();
//首页返回键处理
//处理逻辑:1秒内,连续两次按返回键,则退出应用;
var
first
=
null
;
plus
.
key
.
addEventListener
(
'
backbutton
'
,
function
(){
//首次按键,提示‘再按一次退出应用’
if
(
!
first
){
first
=
new
Date
().
getTime
();
mui
.
toast
(
'
再按一次退出应用
'
);
setTimeout
(
function
(){
first
=
null
;
},
1000
);
}
else
{
if
(
new
Date
().
getTime
()
-
first
<
1000
){
plus
.
runtime
.
quit
();
}
}
},
false
);
//预加载下拉刷新
//预加载下拉刷新
$
.
preload
({
$
.
preload
({
id
:
"
examples/pullrefresh-main.html
"
,
id
:
"
examples/pullrefresh-main.html
"
,
...
...
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