xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

window.open() & iframe & tab

window.open() & iframe & tab

window.open() open pages in the same window / tab

https://stackoverflow.com/questions/8454510/open-url-in-same-window-and-in-same-tab

https://developer.mozilla.org/zh-CN/docs/Web/API/Window/open
https://developer.mozilla.org/zh-CN/docs/Web/API/Window/open#Syntax


autoOpenAlink(e) {
    e.preventDefault();
    let url = this.url;
    window.open(url, "iframe 测试页面");
    // window.open(url, "_self");
},

https://medium.com/the-metric/links-should-open-in-the-same-window-447da3ae59ba

https://www.runoob.com/jsref/met-win-open.html


bug

vue & qrcode

https://www.cnblogs.com/xgqfrms/p/10715627.html


https://github.com/soldair/node-qrcode#es6es7

https://www.npmjs.com/package/qrcode#es6es7


    const QRCode = require("qrcode");


    setTimeout(() => {
        // const QRCode = require("qrcode");
        let canvas = document.getElementById("qrcode_canvas");
        let url = this.url;
        QRCode.toCanvas(
            canvas,
            url,
            function (error) {
                if (error) {
                    console.error(error);
                } else {
                    console.log("success!");
                }
            }
        );
    }, 0);


import QRCode from 'qrcode'

// With promises
QRCode.toDataURL('I am a pony!')
  .then(url => {
    console.log(url)
  })
  .catch(err => {
    console.error(err)
  })

// With async/await
const generateQR = async text => {
  try {
    console.log(await QRCode.toDataURL(text))
  } catch (err) {
    console.error(err)
  }
}

canvas

canvas width height

https://developer.mozilla.org/zh-CN/docs/Web/API/Canvas_API

    setTimeout(() => {
        // const QRCode = require("qrcode");
        let canvas = document.getElementById("qrcode_canvas");
        canvas.width = 100;
        canvas.height = 100;
        let url = this.url;
        QRCode.toCanvas(
            canvas,
            url,
            function (error) {
                if (error) {
                    console.error(error);
                } else {
                    console.log("success!");
                }
            }
        );
    }, 0);

https://stackoverflow.com/questions/4938346/canvas-width-and-height-in-html5

solution

https://github.com/soldair/node-qrcode#width
https://github.com/soldair/node-qrcode#options

    setTimeout(() => {
        // const QRCode = require("qrcode");
        let canvas = document.getElementById("qrcode_canvas");
        // canvas.width = 100;
        // canvas.height = 100;
        // canvas.style.width  = "100px";
        // canvas.style.height = "100px";
        let url = this.url;
        QRCode.toCanvas(
            canvas,
            url,
            {
                width: 120,
            },
            function (error) {
                if (error) {
                    console.error(error);
                } else {
                    console.log("success!");
                }
            }
        );
    }, 0);

ok

posted @   xgqfrms  阅读(342)  评论(3编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2016-04-29 配置Nginx前端 + Apache后端服务器环境
点击右上角即可分享
微信分享提示