本文整理汇总了TypeScript中qrcode-terminal.generate函数的典型用法代码示例。如果您正苦于以下问题:TypeScript generate函数的具体用法?TypeScript generate怎么用?TypeScript generate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: generate
public generate(url: string): void {
try {
qrcode.generate(url);
} catch (err) {
this.$logger.info(`Failed to generate QR code for ${url}`, err);
}
}
示例2: generate
.on('scan', (qrcode) => {
generate(
qrcode,
{
small: true,
},
(asciiart: string) => logElement.setContent(asciiart),
)
})
示例3: generate
.on('scan', (qrcode, status, data) => {
generate(qrcode, { small: true })
if (data) {
console.log(data)
}
console.log(qrcodeValueToImageUrl(qrcode))
console.log('^^^ Online QR Code Image URL ^^^ ')
console.log(`[${status}] ${qrcode} Scan QR Code above url to log in: `)
})
示例4: onScan
/**
*
* 4. You are all set. ;-]
*
*/
/**
*
* 5. Define Event Handler Functions for:
* `scan`, `login`, `logout`, `error`, and `message`
*
*/
function onScan (qrcode: string, status: number) {
generate(qrcode, { small: true })
// Generate a QR Code online via
// http://goqr.me/api/doc/create-qr-code/
const qrcodeImageUrl = [
'https://api.qrserver.com/v1/create-qr-code/?data=',
encodeURIComponent(qrcode),
].join('')
console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `)
}
示例5:
.on('scan', (qrcode, status) => {
QrcodeTerminal.generate(qrcode)
console.log(`${qrcode}\n[${status}] Scan QR Code in above url to login: `)
})
示例6: generate
.on('scan', (qrcode, status) => {
generate(qrcode, { small: true })
console.log(`${status}: ${qrcode} - Scan QR Code of the url to login:`)
})
示例7: generate
.on('scan', (qrcode, status) => {
generate(qrcode, { small: true })
console.log(`${qrcode}\n[${status}] Scan QR Code in above url to login: `)
})