风清月

mui学习三: mui事件

电脑版发表于:2019/11/2 9:54


点击事件在浏览器上不行的问题

mui的tag事件在浏览器上调试是不行的,要使用模拟器或者真机调试才行

当然click事件还是可以执行的,比如这样

var mylogin = document.getElementById("login");
mylogin.onclick=function()
{
	alert("哈哈哈");
	onsole.log("sss");
	console.log();
}


给登录框绑定一个点击事件:

html:

<form class="mui-input-group">
	<div class="mui-input-row">
		<label>用户名</label>
	<input type="text" class="mui-input-clear" placeholder="请输入用户名">
	</div>
	<div class="mui-input-row">
		<label>密码</label>
		<input type="password" class="mui-input-password" placeholder="请输入密码">
	</div>
	<div class="mui-button-row">
		<button type="button" id="login" class="mui-btn mui-btn-primary" >确认</button>
		<button type="button" class="mui-btn mui-btn-danger" >取消</button>
	</div>
</form>

js:

(function(mui){			
	mui.init();			
	mui.plusReady(function () {
					
		var login = document.getElementById("login");
		login.addEventListener("tap",function(event){			    	
			alert("登录!");	
			plus.nativeUI.toast("登录");
		});
	});				
})(mui);


事件的文档:https://dev.dcloud.net.cn/mui/event/


官方的mui文档:https://dev.dcloud.net.cn/mui/ui/#input

模拟器可以考虑夜神模拟器

关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢