移动端网页增加vconsole调试工具

发布于2019年2月26日 19:25:47

很久没更新了,可能是因为最近bug比较多,也可能是比较懒。

在平时的小程序开发中,我们可以借助它自带的vconsole工具调试,可以对我们的代码检测和开发效率有很大的帮助。然而平时我们在开发移动端时,一般都可以借助浏览器自带的响应模式来调试,但平时网页调试好的和我们真机上显示的有时会有误差,比如说,在pc网页上显示好好的,怎么到真机上就挂了,在微信浏览器里也显示不了呢。我最近就遇到了这个问题,用开发者工具上的网页模式调试的好好的,在pc网页端显示也正常,用局域网在真机上显示也正常,可啪,在网页版微信内置浏览器中无法显示。这时就找到了vconsle调试了,果真很好用呀。

在pc微信浏览器调试证明: 该环境下,1、不支持形参赋默认值;2、不支持ES6语法(即不支持let, const, 箭头函数等)

下面为vconsole用法:

在html页面中引入vconsole.min.js

Github地址:https://github.com/Tencent/vConsole

CDN地址:https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js

或 npm i vconsole

引入成功后初始化

<script>
  var vConsole = new VConsole();
  console.log('Hello world');
</script>

然后就可以在页面右下角看到vconsole调试工具了,点击即可看到相关的打印日志

本文共 37 个回复

  • WGinit 2023/06/25 21:56

    当需要打印更多日志信息时,推荐使用 eruda 第三方包

  • cfojVJMtiarmbgL 2024/04/28 03:15

    JYMLewdzlpiZW

  • xnshMBUPQv 2024/05/07 14:58

    xmaFZhVJrSXkP

  • klBcFvdfoMyzj 2024/07/28 19:09

    eHyuIbgYmKo

  • cqzkASOvnyoYTu 2024/08/06 10:09

    SXpnoPyITMsDJQt

  • NTLuomHSkYZAqf 2024/09/16 05:52

    UGoADMJYpZNzFuxb

  • tlovertonet 2024/11/20 06:44

    What¦s Going down i'm new to this, I stumbled upon this I have found It absolutely helpful and it has helped me out loads. I am hoping to give a contribution & aid different customers like its aided me. Great job.

  • mindvault 2025/10/14 23:50

    **mindvault** mindvault is a premium cognitive support formula created for adults 45+. It’s thoughtfully designed to help maintain clear thinking

  • mind vault 2025/10/17 21:52

    **mind vault** mind vault is a premium cognitive support formula created for adults 45+. It’s thoughtfully designed to help maintain clear thinking

  • sugarmute 2025/10/19 01:14

    **sugarmute** sugarmute is a science-guided nutritional supplement created to help maintain balanced blood sugar while supporting steady energy and mental clarity.

  • glpro 2025/10/19 05:34

    **glpro** glpro is a natural dietary supplement designed to promote balanced blood sugar levels and curb sugar cravings.

  • prostadine 2025/10/19 09:21

    **prostadine** prostadine is a next-generation prostate support formula designed to help maintain, restore, and enhance optimal male prostate performance.

  • vitta burn 2025/10/19 14:52

    **vitta burn** vitta burn is a liquid dietary supplement formulated to support healthy weight reduction by increasing metabolic rate, reducing hunger, and promoting fat loss.

  • glucore 2025/10/19 14:53

    **glucore** glucore is a nutritional supplement that is given to patients daily to assist in maintaining healthy blood sugar and metabolic rates.

  • prodentim 2025/10/19 14:55

    **prodentim** prodentim an advanced probiotic formulation designed to support exceptional oral hygiene while fortifying teeth and gums.

  • synaptigen 2025/10/19 15:14

    **synaptigen** synaptigen is a next-generation brain support supplement that blends natural nootropics, adaptogens

  • nitric boost 2025/10/19 15:14

    **nitric boost** nitric boost is a dietary formula crafted to enhance vitality and promote overall well-being.

  • mitolyn 2025/10/19 17:44

    **mitolyn** mitolyn a nature-inspired supplement crafted to elevate metabolic activity and support sustainable weight management.

  • wildgut 2025/10/19 17:49

    **wildgut** wildgutis a precision-crafted nutritional blend designed to nurture your dog’s digestive tract.

  • zencortex 2025/10/19 18:03

    **zencortex** zencortex contains only the natural ingredients that are effective in supporting incredible hearing naturally.

  • yu sleep 2025/10/19 18:53

    **yu sleep** yusleep is a gentle, nano-enhanced nightly blend designed to help you drift off quickly, stay asleep longer, and wake feeling clear.

  • breathe 2025/10/20 02:19

    **breathe** breathe is a plant-powered tincture crafted to promote lung performance and enhance your breathing quality.

  • pinealxt 2025/10/20 15:01

    **pinealxt** pinealxt is a revolutionary supplement that promotes proper pineal gland function and energy levels to support healthy body function.

  • energeia 2025/10/20 15:26

    **energeia** energeia is the first and only recipe that targets the root cause of stubborn belly fat and Deadly visceral fat.

  • prostabliss 2025/10/20 16:19

    **prostabliss** prostabliss is a carefully developed dietary formula aimed at nurturing prostate vitality and improving urinary comfort.

  • boostaro 2025/10/20 16:47

    **boostaro** boostaro is a specially crafted dietary supplement for men who want to elevate their overall health and vitality.

  • potentstream 2025/10/20 21:26

    **potentstream** potentstream is engineered to promote prostate well-being by counteracting the residue that can build up from hard-water minerals within the urinary tract.

  • hepatoburn 2025/10/21 12:57

    **hepatoburn** hepatoburn is a premium nutritional formula designed to enhance liver function, boost metabolism, and support natural fat breakdown.

  • hepato burn 2025/10/21 17:30

    **hepato burn** hepato burn is a potent, plant-based formula created to promote optimal liver performance and naturally stimulate fat-burning mechanisms.

  • flowforce max 2025/10/22 02:39

    **flowforce max** flowforce max delivers a forward-thinking, plant-focused way to support prostate health—while also helping maintain everyday energy, libido, and overall vitality.

  • prodentim 2025/10/22 03:58

    **prodentim** prodentim is a forward-thinking oral wellness blend crafted to nurture and maintain a balanced mouth microbiome.

  • cellufend 2025/10/22 04:30

    **cellufend** cellufend is a natural supplement developed to support balanced blood sugar levels through a blend of botanical extracts and essential nutrients.

  • revitag 2025/10/22 05:39

    **revitag** revitag is a daily skin-support formula created to promote a healthy complexion and visibly diminish the appearance of skin tags.

  • neurogenica 2025/10/22 05:45

    **neurogenica** neurogenica is a dietary supplement formulated to support nerve health and ease discomfort associated with neuropathy.

  • sleeplean 2025/10/23 05:53

    **sleeplean** sleeplean is a US-trusted, naturally focused nighttime support formula that helps your body burn fat while you rest.

  • memory lift 2025/10/25 00:17

    **memory lift** memory lift is an innovative dietary formula designed to naturally nurture brain wellness and sharpen cognitive performance.

回复 glpro 取消