提交 97dc3950 authored 作者: 曹末's avatar 曹末

password问题 switch问题

上级 501ebf20
......@@ -9,7 +9,8 @@ Page({
*/
data: {
username: "",
password: ""
password: "",
showPassword: false
},
login() {
if (this.data.username.trim() === "") {
......@@ -41,59 +42,9 @@ Page({
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
iconClick() {
this.setData({
showPassword: !this.data.showPassword
})
}
})
\ No newline at end of file
<view>
<t-input label="账号" model:value="{{username}}" />
<t-input label="密码" type="password" model:value="{{password}}" suffixIcon="{{ { name: 'browse-off', ariaLabel: '密码' } }}" />
<t-input label="密码" type="{{showPassword?'text':'password'}}" model:value="{{password}}">
<t-icon slot="suffix-icon" name="{{showPassword?'browse':'browse-off'}}" ariaLabel="密码" bind:click="iconClick"></t-icon>
</t-input>
<t-button theme="primary" size="large" block t-class="external-class" bind:tap="login">登录</t-button>
</view>
\ No newline at end of file
......@@ -13,7 +13,8 @@ Page({
password: "",
remark: "",
isAdmin: false,
isModify: false
isModify: false,
showPassword: false
},
/**
......@@ -62,5 +63,15 @@ Page({
}).then(res => {
wx.navigateBack()
})
},
iconClick() {
this.setData({
showPassword: !this.data.showPassword
})
},
switchChange(e) {
this.setData({
isAdmin: e.detail.value
})
}
})
\ No newline at end of file
<view>
<t-input label="账号" model:value="{{label}}"></t-input>
<t-input wx:if="{{!isModify}}" label="密码" model:value="{{password}}" type="password"></t-input>
<t-input wx:if="{{!isModify}}" label="密码" type="{{showPassword?'text':'password'}}" model:value="{{password}}">
<t-icon slot="suffix-icon" name="{{showPassword?'browse':'browse-off'}}" ariaLabel="密码" bind:click="iconClick"></t-icon>
</t-input>
<t-input label="备注" model:value="{{remark}}"></t-input>
<t-cell title="管理员" bordered="{{false}}">
<t-switch model:value="{{isAdmin}}" slot="note" />
<t-switch value="{{isAdmin}}" slot="note" bind:change="switchChange"/>
</t-cell>
<t-button style="margin-top: 64rpx;" theme="primary" size="large" block t-class="external-class" bind:tap="handleClick">{{isModify?"更新":"新建"}}</t-button>
</view>
\ No newline at end of file
......@@ -50,8 +50,10 @@ Page({
})
},
logout() {
if (this.data.username && this.data.username !== "") {
ActionSheet.show(basicListOption)
}
}
});
const basicListOption = {
......
......@@ -3,13 +3,13 @@
<t-action-sheet id="t-action-sheet" usingCustomNavbar bind:selected="handleSelected" />
<view class="top_bg" />
<view class="main_content">
<view class="userinfo_container">
<view class="userinfo_container" style="width:100%" bind:tap="logout">
<image class="avatar" src="../../images/icons/avatar.png" mode="widthFix" />
<block wx:if="{{ username==='' }}">
<view class="username" bind:tap="toLogin">请点击登录</view>
</block>
<block wx:else>
<view class="username" bind:tap="logout">{{ username }}</view>
<view class="username">{{ username }}</view>
</block>
</view>
<view class="settings_container">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论