添加返回按钮
//detail.js
ccc: function () {
wx.navigateBack({
})
}
<!--detail.wxml-->
<view class='cc' bindtap='ccc'>返回</view>
动态设置当前页面的标题
onLoad: function () {
wx.setNavigationBarTitle({
title: '隐私'
})}
//set.js
Page({
formSubmit(e) {
console.log('数据为:', e.detail.value)
},
formReset() {
console.log('form发生了reset事件')
},
onLoad: function () {
wx.setNavigationBarTitle({
title: '设置'
})
},
ys:function(){
wx.navigateTo({
url: '../form/form?id={{id}}',
})
},
dc: function () {
wx.navigateTo({
url: '../servey/servey?id={{id}}',
})
}
})
//set.wxml
<form bindsubmit="formSubmit" bindreset="formReset">
<view class='ys'>账号与安全</view>
<view class='back-a'></view>
<view class='ys'>新消息通知</view>
<view class='back-b'></view>
<view bindtap='ys' class='ys'>隐私</view>
<view class='back-b'></view>
<view class='ys'>通用</view>
<view class='back-a'></view>
<view bindtap='dc' class='ys'>个人信息</view>
<view class='back-b'></view>
<view class='ys'>帮助与反馈</view>
<view class='back-b'></view>
<view class='ys'>关于微信</view>
<view class='back-a'></view>
<view class='ys'>插件</view>
<view class='back-a'></view>
<button>切换账号</button>
<view class='back-a'></view>
<button>退出登录</button>
<view class='back-c'></view>
</form>
Page({
formSubmit(e) {
console.log('数据为:', e.detail.value)
},
formReset() {
console.log('form发生了reset事件')
},
onLoad: function () {
wx.setNavigationBarTitle({
title: '个人信息'
})
},
})
<form bindsubmit="formSubmit" bindreset="formReset">
<view class="section section_gap">
<view class="stitle">音量控制</view>
<slider name="slider" show-value></slider>
</view>
<view class="section">
<view class="stitle">喜欢这首歌的理由</view>
<input class='ys' placeholder="请在这里输入" />
</view>
<view class="section section_gap">
<view class="stitle">性别</view>
<radio-group class="group">
<label>
<radio value="radio1" />
男
</label>
<label>
<radio value="radio2" />
女
</label>
</radio-group>
</view>
<view class="section section_gap">
<view class="stitle">爱好</view>
<checkbox-group name="checkbox">
<label>
<checkbox value="checkbox1" />
看电影
</label>
<label>
<checkbox value="checkbox2" />
阅读
</label>
<label>
<checkbox value="checkbox3" />
摄影
</label>
<label>
<checkbox value="checkbox3" />
学习
</label>
</checkbox-group>
</view>
<view class="btn-area">
<button form-type="submit">提交</button>
<button form-type="reset">重置</button>
</view>
</form>
登录和支付按钮
dl:function(){
wx.login({
success(res) {
if (res.code) {
// 发起网络请求
wx.request({
url: 'https://blog.csdn.net/qq_39925376',
data: {
code: res.code
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
},
pay:function(){
wx.requestPayment({
timeStamp: '',
nonceStr: '',
package: '',
signType: 'MD5',
paySign: '',
success(res) { },
fail(res) { }
})
}