开发者工具版本:v1.02.1904090自己定制的input标签在开发者工具预览的时候会自动跳到下一个标签内,有时候又会来回跳。真机模拟不会。wxml代码:
<view class=‘row’ style=’ background-image:url({{login_bg}});’>
<view class=‘login’>
<form bindsubmit=‘loginIn’>
<view class=‘b20’>
<input type=‘text’ name=“username” placeholder=‘请输入账号’ value=’’></input>
</view>
<view class=‘b20’>
<input type=‘password’ name=“password” placeholder=‘请输入密码’ value=’’></input>
</view>
<button form-type=‘submit’>登陆</button>
</form>
</view>
</view>
wxss代码:
/* pages/login.wxss */
.login{
width: 70%;
height:400rpx;
margin: 0 auto;
margin-top: 400rpx;
}
.login button{
float: left;
width: 100%;
}
.b20{
margin-bottom: 30rpx;
width: 100%;
float: left;
height: 100rpx;
}
.b20 input{
padding: 5px;
background-color: #f9f9f9;
border-radius: 10rpx;
height: 80rpx;
text-align: center;
}
js代码:
// pages/login.js
var app = new getApp();
Page({
/**
* 页面的初始数据
*/
data: {
login_bg: app.url.stc +"/images/login_bg.png"
},
loginIn:function(e){
console.log(e);
var username = e.detail.value.username;
var password = e.detail.value.password;
console.log(username + password);
if(username == ‘’){
wx.showLoading({
title: ‘账号为空’,
});
setTimeout(function () {
wx.hideLoading()
}, 2000)
return;
}
if (password == ‘’) {
wx.showLoading({
title: ‘密码为空’,
});
setTimeout(function () {
wx.hideLoading()
}, 2000)
return;
}
//var data = “username=”+username+"&password="+password;
wx.request({
url: app.url.stc+’/admin/login.do’,
data:{
username:username,
password:password
},
header: {
“Content-Type”: “application/x-www-form-urlencoded”
},
method: “POST”,
success(res) {
console.log(res);
if (res.statusCode == 200){
if (res.data.result == 0){
var cookies = res.header[‘Set-Cookie’];
cookies = cookies.split(";")[0];
if (wx.getStorageSync(“cookieKey”) == ‘’){
wx.setStorageSync(‘cookieKey’, cookies);
app.header.cookie= cookies;
}
wx.showLoading({
title: ‘登陆成功’,
});
setTimeout(function () {
wx.hideLoading()
wx.reLaunch({
url: ‘…/home/home’
})
}, 2000)
}else{
wx.showModal({
title: ‘提示’,
content: ‘用户名或者密码错误’,
showCancel: false
})
}
}else{
wx.showModal({
title: ‘提示’,
content: ‘用户名或者密码错误’,
showCancel: false
})
}
},
fail: function () {
wx.showToast({
title: ‘登陆失败’,
icon: ‘success’,
duration: 2000
})
}
});
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
if (wx.getStorageSync(“cookieKey”) != ‘’){
console.log(“有cookie值”);
wx.reLaunch({
url: ‘…/home/home’
})
}
},
/**
* 生命周期函数–监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数–监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数–监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数–监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数–监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
游标自动跳是什么表现?这个能提供下视频么?还有是哪个版本的开发工具呢?另外麻烦把上面的代码整理成能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。