qrcode & console.log
qrcode & console.log
image
https://fs-api.lightyy.com/service/utils/qrcode?url=http://169.254.130.54:3000/#/chat
import Light from "light";
/**
* 打印二维码
*/
function printQRCode(hashpath) {
//93781 lighting工程不管是jsn项目还是纯h5项目都在控制台显示二维码
let path = location.pathname;
//110579:--onlyfor h5 时二维码打印h5的
if (typeof weex !== "undefined" && Light.onlyFor !== 'h5') {
//105231 二维码内容兼容多页工程
path = (path === "/" || path === "/index.html") ? `/${Light.mainPage}.native.js` : path.replace(/\.html/ig, ".native.js");
}
//128463当无法联网的环境下时,不再去请求平台接口来显示二维码
if(navigator.onLine){
let urlToScan = `http://${location.host}${path}${location.search}#${hashpath}`;
Light.ajax({
url:`https://fs-api.lightyy.com/service/utils/qrcode?url=${encodeURIComponent(urlToScan)}`,
type:"get",
dataType:"json",
success(data){
console.log("LightView 扫码 URL: " + urlToScan);
//91631 最新版本chrome浏览器的console无法打印二维码
console.log("%c ", "padding:75px 80px 75px;background:url(" + data.data + ") no-repeat;background-size:150px");
}
})
}
}
/**
* 计算节点的数量
* @param node
* @returns {number}
*/
function countNodes(node) {
let count = 1;
if(node.hasChildNodes()) {
let cnodes = node.childNodes;
for(let i=0; i<cnodes.length; i++) {
count = count + countNodes(cnodes.item(i))
}
}
return count;
}
/**
* 计算节点的层数
* @param node
* @returns {number}
*/
function countLevels(node) {
if(node.hasChildNodes()) {
let cnodes = node.childNodes;
let levels = [];
cnodes.forEach(function (n) {
levels.push( 1 + countLevels(n))
})
return Math.max(...levels)
}else{
return 1;
}
}
Light.filter("route", function (from, to, next) {
try {
next();
printQRCode(to.fullPath);
//93785 lighting工程在展示当前视图的dom节点数量和最深的节点层次
setTimeout(function () {
let count = countNodes(document.body);
let level = countLevels(document.body);
console.log(`当前视图的DOM节点总数为:${count},最深的DOM节点层次为:${level}`);//
},1000)
}catch (e) {
console.log(e)
}
});
//93779 lighting工程编译时如果是添加了-w选项则在控制台提示用户可以查看编译资源树及分析
console.log(`%c查看编译资源详情请点击链接:http://${location.host}/stats.html`,"font-size:15px;color:red;font-weight:bolder");
//////////////////
// WEBPACK FOOTER
// C:/Users/xiagq/.lighting-plugins/node_modules/lighting-plugin-type-vue/plugins/qrcode.js
// module id = 305
// module chunks = 0
base 64
flutter ios app
https://github.com/X-Wei/flutter_catalog
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/11102338.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2018-06-28 IE & ES6 & String.includes() & String.startsWith()
2018-06-28 Bootstrap & H5 DnD
2018-06-28 ES6 polyfills & String.includes() & Array.includes()
2016-06-28 Meteor is an open source platform for web, mobile, and desktop.
2016-06-28 node.js <=> Command Line Options