今天遇到问题是只有电脑的微信打开公众号的链接和某些手机打开会发现无法正常显示的问题。
虽然猜到有可能是加了es6写法不支持,但是找哪里写的还是比较麻烦的。恰巧发现了手机端可以用微信自己开发的vConsole。记录一下,方便以后使用。
/*!
* vconsole v2.2.0 (https://github.com/WechatFE/vConsole)
* Copyright 2016, WechatFE Team
* MIT license
*/
!function(e,t){
"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vConsole=t():e.vConsole=t()}(this,function(){
return function(e){
function t(n){
if(o[n])return o[n].exports;var r=o[n]={
exports:{
},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={
};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){
"use strict";function n(e){
return e&&e.__esModule?e:{
"default":e}}Object.defineProperty(t,"__esModule",{
value:!0});var r=o(1),i=n(r),l=o(14),c=n(l),a=o(15),s=n(a),d=o(22),u=n(d),f=o(24),v=n(f),p=new i["default"];p.addPlugin(s["default"]),p.addPlugin(u["default"]),p.addPlugin(v["default"]),p.VConsolePlugin=c["default"],t["default"]=p,e.exports=t["default"]},function(e,t,o){
"use strict";function n(e){
if(e&&e.__esModule)return e;var t={
};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t["default"]=e,t}function r(e){
return e&&e.__esModule?e:{
"default":e}}function i(e,t){
if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{
value:!0});var l=function(){
function e(e,t){
for(var o=0;o<t.length;o++){
var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){
return o&&e(t.prototype,o),n&&e(t,n),t}}(),c=o(2),a=r(c),s=o(3),d=n(s),u=o(4),f=r(u);o(6);var v=o(10),p=r(v),b=o(11),g=r(b),h=o(12),m=r(h),y=o(13),_=r(y),w=function(){
function e(){
i(this,e);var t=this;this.version=a["default"].version,this.html=p["default"],this.$dom=null,this.activedTab="",this.tabList=[],this.pluginList={
},this.console={
},this.logList=[],this.isReady=!1,this.switchPos={
x:10,y:10,startX:0,startY:0,endX:0,endY:0},this.bodyOverflowCSS="",this.tool=d,this.$=f["default"];var o=function(){
t._render(),t._bindEvent(),t._autoRun()};"complete"==document.readyState?o():f["default"].bind(window,"load",o)}return l(e,[{
key:"_render",value:function(){
var e="#__vconsole";if(!f["default"].one(e)){
var t=document.createElement("div");t.innerHTML=this.html,document.body.appendChild(t.children[0])}this.$dom=f["default"].one(e);var o=d.getStorage("switch_x"),n=d.getStorage("switch_y");o&&n&&(this.switchPos.x=o,this.switchPos.y=n,f["default"].one(".vc-switch").style.right=o+"px",f["default"].one(".vc-switch").style.bottom=n+"px")}},{
key:"_bindEvent",value:function(){
var e=this,t=f["default"].one(".vc-switch",e.$dom);f["default"].bind(t,"touchstart",function(t){
e.switchPos.startX=t.touches[0].pageX,e.switchPos.startY=t.touches[0].pageY}),f["default"].bind(t,"touchend",function(t){
0==e.switchPos.endX&&0==e.switchPos.endY||(e.switchPos.x=e.switchPos.endX,e.switchPos.y=e.switchPos.endY,e.switchPos.startX=0,e.switchPos.startY=0,e.switchPos.endX=0,e.switchPos.endY=0,d.setStorage("switch_x",e.switchPos.x),d.setStorage("switch_y",e.switchPos.y))}),f["default"].bind(t,"touchmove",function(o){
if(o.touches.length>0){
var n=o.touches[0].pageX-e.switchPos.startX,r=o.touches[0].pageY-e.switchPos.startY,i=e.switchPos.x-n,l=e.switchPos.y-r;0>i&&(i=0),0>l&&(l=0),i+t.offsetWidth>document.body.offsetWidth&&(i=document.body.offsetWidth-t.offsetWidth),l+t.offsetHeight>document.body.offsetHeight&&(l=document.body.offsetHeight-t.offsetHeight),t.style.right=i+"px",t.style.bottom=l+"px",e.switchPos.endX=i,e.switchPos.endY=l,o.preventDefault()}}),f["default"].bind(f["default"].one(".vc-switch",e.$dom),"click",function(){
e.show()}),f["default"].bind(f["default"].one(".vc-hide",e.$dom),"click",function(){
e.hide()}),f["default"].bind(f["default"].one(".vc-mask",e.$dom),"click",function(t){
return t.target!=f["default"].one(".vc-mask")?!1:void e.hide()}),f["default"].delegate(f["default"].one(".vc-tabbar",e.$dom),"click",".vc-tab",function(t){
var o=this.dataset.tab;o!=e.activedTab&&e.showTab(o)})}},{
key:"_autoRun",value:function(){
this.isReady=!0;for(var e in this.pluginList)this._initPlugin(this.pluginList[e]);this.showTab(this.tabList[0])}},{
key:"_initPlugin",value:function(e){
var t=this;e.trigger("init"),e.trigger("renderTab",function(o){
t.tabList.push(e.id);var n=f["default"].render(g["default"],{
id:e.id,name:e.name});f["default"].one(".vc-tabbar",t.$dom).appendChild(n);var r=f["default"].render(m["default"],{
id:e.id});o&&(d.isString(o)?r.innerHTML+=o:d.isFunction(o.appendTo)?o.appendTo(r):d.isElement(o)&&r.appendChild(o)),f["default"].one(".vc-content",t.$dom).appendChild(r)}),e.trigger("addTool",function(t){
if(t)for(var o=f["default"].one(".vc-tool-last"),n=0;n<t.length;n++){
var r=t[n],i=f["default"].render(_["default"],{
name:r.name||"Undefined",pluginID:e.id});1==r.global&&f["default"].addClass(i,"vc-global-tool"),d.isFunction(r.onClick)&&f["default"].bind(i,"click",r.onClick),o.parentNode.insertBefore(i,o)}}),e.trigger("ready")}},{
key:"_triggerPluginsEvent",value:function(e){
for(var t in this.pluginList)this