Commit 5796b579 authored by hbcui1984's avatar hbcui1984

input页面使用模板机制

parent 59d5dde2
...@@ -16,19 +16,10 @@ ...@@ -16,19 +16,10 @@
background-color: #efeff4; background-color: #efeff4;
} }
</style> </style>
<script>
mui.init();
</script>
</head> </head>
<body> <body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">输入框(Input)</h1>
</header>
<div class="mui-content"> <div class="mui-content">
<div class="mui-content-padded" style="margin: 5px;"> <div class="mui-content-padded" style="margin: 5px;">
<h5>默认搜索框:</h5> <h5>默认搜索框:</h5>
<div class="mui-input-row mui-search"> <div class="mui-input-row mui-search">
...@@ -81,6 +72,7 @@ ...@@ -81,6 +72,7 @@
} }
</style> </style>
<script> <script>
mui.init();
//语音识别完成事件 //语音识别完成事件
document.getElementById("search").addEventListener('recognized', function(e) { document.getElementById("search").addEventListener('recognized', function(e) {
console.log(e.detail.value); console.log(e.detail.value);
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</a> </a>
</li> </li>
<li class="mui-table-view-cell"> <li class="mui-table-view-cell">
<a class="mui-navigate-right" open-type="common" href="examples/inputs.html"> <a class="mui-navigate-right" href="examples/inputs.html">
输入框(input) 输入框(input)
</a> </a>
</li> </li>
...@@ -92,34 +92,20 @@ ...@@ -92,34 +92,20 @@
}) })
mui('.mui-table-view').on('tap', 'a', function() { mui('.mui-table-view').on('tap', 'a', function() {
var id = this.getAttribute("href"); var id = this.getAttribute("href");
var type = this.getAttribute("open-type"); if (subWebview == null) {
if(type=="common"){ template = plus.webview.getWebviewById("default-main");
mui.openWindow({ subWebview = template.children()[0];
id: id, }
url: this.href, //判断是否显示右上角menu图标;
styles:{ var showMenu = ~id.indexOf('popovers.html')?true:false;
zindex:2 var title = this.innerText;
}, mui.fire(template,'updateHeader',{title:title,showMenu:showMenu});
waiting:{ if(subWebview.getURL()==this.href){
autoShow:false subWebview.show();
}
});
}else{ }else{
if (subWebview == null) { subWebview.loadURL(this.href);
template = plus.webview.getWebviewById("default-main");
subWebview = template.children()[0];
}
//判断是否显示右上角menu图标;
var showMenu = ~id.indexOf('popovers.html')?true:false;
var title = this.innerText;
mui.fire(template,'updateHeader',{title:title,showMenu:showMenu});
if(subWebview.getURL()==this.href){
subWebview.show();
}else{
subWebview.loadURL(this.href);
}
template.show('slide-in-right', 150);
} }
template.show('slide-in-right', 150);
}); });
/** /**
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
</a> </a>
</li> </li>
<li class="mui-table-view-cell"> <li class="mui-table-view-cell">
<a class="mui-navigate-right" open-type="common" href="examples/inputs.html"> <a class="mui-navigate-right" href="examples/inputs.html">
input(输入框) input(输入框)
</a> </a>
</li> </li>
...@@ -193,10 +193,10 @@ ...@@ -193,10 +193,10 @@
media list(图文列表) media list(图文列表)
</a> </a>
</li> </li>
<!--<li class="mui-table-view-cell"> <!--<li class="mui-table-view-cell">
<a class="mui-navigate-right" open-type='common' href="examples/modals.html"> <a class="mui-navigate-right" open-type='common' href="examples/modals.html">
modal(弹出窗口) modal(弹出窗口)
</a> </a>
</li>--> </li>-->
<li class="mui-table-view-cell"> <li class="mui-table-view-cell">
<a class="mui-navigate-right" open-type="common" href="examples/nav.html"> <a class="mui-navigate-right" open-type="common" href="examples/nav.html">
...@@ -549,6 +549,7 @@ ...@@ -549,6 +549,7 @@
e.detail.gesture.preventDefault(); e.detail.gesture.preventDefault();
}); });
//监听右滑事件,若侧滑菜单未显示,右滑要显示菜单; //监听右滑事件,若侧滑菜单未显示,右滑要显示菜单;
window.addEventListener("swiperight",function (e) { window.addEventListener("swiperight",function (e) {
//默认滑动角度在-45度到45度之间,都会触发右滑菜单,为避免误操作,可自定义限制滑动角度; //默认滑动角度在-45度到45度之间,都会触发右滑菜单,为避免误操作,可自定义限制滑动角度;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment