Fork me on GitHub
  1. 热敏打印机无法调整font-size

    Web前端需要连接热敏打印机打印小票,但是font-size始终无法调小,最终解决见demo:

    update:2020年12月04日

    https://medium.com/@Idan_Co/the-ultimate-print-html-template-with-header-footer-568f415f6d2a

    <!DOCTYPE HTML>
    <html>
    
    <head>
        <meta name="renderer" content="webkit">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>美问</title>
        <style type="text/css">
        @media screen {
            #printSection {
                display: none …
    read more

    There are comments.

  2. Google Chrome 控制台

    console

    console.log(object [, object, ...])

    console.info(object [, object, ...])

    console.error(object [, object, ...])

    var str = 'hello world';
    console.log('--->>>%s', str);
    

    常用格式代码:

    说明符 输出
    %s 将值格式化为字符串
    %i 或 %d 将值格式化 …
    read more

    There are comments.

  3. JS中toFixed的坑

    重点:toFixed不是四舍五入

    MDN:

    toFixed() 方法使用定点表示法来格式化一个数。

    Chrome:

    console.log((0.005).toFixed(2)) -> 0.01
    console.log((0.015).toFixed(2)) -> 0.01
    console.log((0.025).toFixed(2)) -> 0.03
    console.log((0.035 …
    read more

    There are comments.

links

social