「小程序JAVA实战」 小程序远程调试(九)
转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-09/
在开发javaweb应用的时候,如果遇见一个问题都会调试,debug,在火狐和谷歌浏览器的时候我们也可以使用断点的方式调试js,小程序可以吗?肯定是可以的!小程序的调试也可以在手机端进行远程调试。源码:https://github.com/limingios/wxProgram.git 中的No.4
开始演示
- 登录微信小程序,获取appId,远程调试必须有AppID

- 新建项目
记住这个必须填入AppID

- 了解功能按键
>预览:手机可以通过扫描二维码的方式在手机上直接观看小程序
>远程调试:可以在手机上进行操作,并且可以在电脑上弹出对应的控制台,来观察操作的效果,同时在手机和电脑上进行调试。

- 修改初始化代码
>源码:https://github.com/limingios/wxProgram.git 中的No.4
- app.js
//app.js
App({
onLaunch: function (options) {
console.log("onLaunch")
},
onShow: function (options) {
console.log("onShow")
},
onHide: function () {
console.log("onHide")
},
onError: function (msg) {
console.log("onError")
},
globalData: 'I am global data'
})
- app.json
{
"pages":[
"pages/index/index"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle":"black"
}
}
- index.wxml
<!--index.wxml-->
<view class="container">
{{motto}}
</view>
- index.js
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onLoad: function () {
this.setData({
motto: app.globalData
})
}
})

- 打断点,源码中加入debugger
- app.js
//app.js
App({
onLaunch: function (options) {
debugger
console.log("onLaunch")
},
onShow: function (options) {
debugger
console.log("onShow")
},
onHide: function () {
debugger
console.log("onHide")
},
onError: function (msg) {
debugger
console.log("onError")
},
globalData: 'I am global data'
})

- 编辑工具下的调试
> 开启调试器,可以通过f10单步进行调试


- 安装itools手机可以实时看到手机上的
>扫描预览的效果


- 打开手机的调试


- 重新进入小程序

点击vConsole
这里出发了onHide,上次在工具开发预览的时候并没有触发。.

- 开启远程调试
>点击开启远程调试,也会生成一个二维码

- 手机扫一扫,

出现命中断点和远程调试窗口

- 可以看到类似web调试的一些工具

- 可以查看远端代码

PS:最后想到了什么老铁,可以查看远端的代码是不是就可以获取到借鉴他的代码了。其实微信早就想到了,不是所有的都可以的。远端调试必须知道他的APPID的,不是说直接看就可以了。
「小程序JAVA实战」 小程序远程调试(九)的更多相关文章
- 「小程序JAVA实战」小程序的flex布局(22)
转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-22/ 之前已经把小程序的框架说完了,接下来说说小程序的组件,在说组件之前,先说说布局吧.源码:ht ...
- 「小程序JAVA实战」小程序的留言和评价功能(70)
转自:https://idig8.com/2018/10/28/xiaochengxujavashizhanxiaochengxudeliuyanhepingjiagongneng69/ 目前小程序这 ...
- 「小程序JAVA实战」小程序的举报功能开发(68)
转自:https://idig8.com/2018/09/25/xiaochengxujavashizhanxiaochengxudeweixinapicaidancaozuo66-2/ 通过点击举报 ...
- 「小程序JAVA实战」小程序的个人信息作品,收藏,关注(66)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudegerenxinxizuopinshoucangguanzhu65 ...
- 「小程序JAVA实战」小程序的关注功能(65)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeguanzhugongneng64/ 在个人页面,根据发布者个人和 ...
- 「小程序JAVA实战」小程序的视频点赞功能开发(62)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeshipindianzangongnengkaifa61/ 视频点 ...
- 「小程序JAVA实战」小程序的springboot后台拦截器(61)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudespringboothoutailanjieqi60/ 之前咱们把 ...
- 「小程序JAVA实战」小程序首页视频(49)
转自:https://idig8.com/2018/09/21/xiaochengxujavashizhanxiaochengxushouyeshipin48/ 视频显示的内容是视频的截图,用户的头像 ...
- 「小程序JAVA实战」小程序视频封面处理(48)
转自:https://idig8.com/2018/09/16/xiaochengxujavashizhanxiaochengxushipinfengmianchuli47/ 截图这块,在微信小程序工 ...
随机推荐
- 18-THREE.JS 基本材质
<!DOCTYPE html> <html> <head> <title></title> <script src="htt ...
- 【git】常用命令大全
Git常用操作命令收集: 1) 远程仓库相关命令 检出仓库:$ git clone git://github.com/jquery/jquery.git 后边接仓库文件地址 查看远程仓库:$ gi ...
- css3 伪类
::selection { 选中后的样式 } 链接 p:only-child p的父级只有一个p标签 p:only-of-type p的父级有一个p标签, 但还可以包含其他标签 p:fis ...
- Visual Studio 2013中用VSIX创建项目模版
我会一步一步解释: 我的一个项目里有5个工程, 我想用其中的4个去创建一个新的工具模版,我还想把他们都放到一个文件夹下面当我用这个模版创建新的工程时.注意我的初始化项目,我想把他们转换成一个模版(我不 ...
- 让cocos h5里的文字可以在手机上被长按复制
更改CCBoot.js代码: // Adjust mobile css settings if (cc.sys.isMobile) { var fontStyle = document.createE ...
- iPhone图片拉伸:resizableImageWithCapInsets
1 [[UIImage imageNamed:@"button_textured_30"] resizableImageWithCapInsets:UIEdgeInsetsMake ...
- Python学习-括号
python语言最常见的括号有三种,分别是:小括号( ).中括号[ ]和大括号也叫做花括号{ }.其作用也各不相同,分别用来代表不同的python基本内置数据类型. 1.python中的小括号( ): ...
- 区分/不区分大小写的比较,查找字符串在另一字符串中的位置,字符串开头是否包括另一字符串 hasPrefix
NSString *str; // 使用stringWithFormat生成一格式化字符串 str = [NSString stringWithFormat:@"This is %@&quo ...
- cordic算法的fpga实现
cordic算法参考:http://wenku.baidu.com/view/6c623aa8910ef12d2bf9e732.html 这是百度文库的一个文档,详细介绍了cordic算法的基本内容. ...
- terraform 阿里云基本使用
1. 预备环境 安装了terraform 的软件的操作系统(windows linux mac 均可) 具有阿里云账户的 access_key secret_key 2. 配置 // terrafor ...
