赞
踩
1、新建要跳转到的页面,比如,login文件夹下login.wxml、login.json、login.js、login.wxss;
2、app.json中注册新页面
- "pages": [
- "pages/index/index",
- "pages/login/login", //新注册的页面
- "pages/contact/contact",
- "pages/message/message",
- "pages/payment/payment",
- "pages/qrcode/qrcode",
- "pages/upload/upload",
- "pages/service/service",
- "pages/sms/sms"
- ],
3、比如在index.wxml中添加超链接
- <view class="container">
- <button bindtap="login">登陆</button> //绑定:bindtap = 到关键字为 login 要跳转的页面
- <button bindtap="upload">上传图片到后端服务器</button>
- <button bindtap="qrcode">事件二维码</button>
- <button bindtap="payment">微信支付</button>
- <button bindtap="contact">客服会话</button>
- <button bindtap="message">模板消息</button>
- <button bindtap="sms">手机验证码</button>
- </view>
4、在index.js中对关键字login进行配置
- var app = getApp() //初始化
- Page({ //页面内容Page({
- //里面有data:{要绑定的数据},
- //有事件处理函数
- //...
- })
- data: {
- userImg: "../../images/defult_userimg.png",
- userName: "未登录",
- },
- //事件处理函数
- login:function(){ //绑定关键字login:函数function(){ 执行命令},
- wx.navigateTo({ //微信wx的.导航/到navigateTo({url:''})
- url: '../login/login', //url地址
- })
- },
- upload: function () {
- wx.navigateTo({
- url: '../upload/upload'
- })
- },
注意:不能跳转tabBar页面
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。