Skip to content

1019

工作

  • html2pdf 需求,涉及到 模板引擎问题;若有提供浏览器环境的话,可以使用 react;那么,在 html 直接使用 react 开发怎么开发呢
    • 需要引入 React
    • 需要引入 ReactDOM
    • 需要引入 babel
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
  <script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
</head>

<body>    
  <div id="root"></div>

  <script type="text/babel">
     const w = "world"
     const tpl = (
       <h1>Hello, {w}</h1>
     )
     ReactDOM.render(tpl, document.getElementById('root'))
  </script>
</body>

</html>
  • css 样式:first-child 和 first-of-type 区别:
css
li:not(first-child) {
  border: 1px solid black;
}

但是并没有我想要的效果;

可以这么写:

css
li:not(:first-of-type) {
  border: 1px solid black;
}

区别:

- first-child: 表示该父元素下第一个子元素
- first-of-type: 表示父元素下第一个**同类型**的子元素
css
body {
      -webkit-print-color-adjust: exact;
      -moz-print-color-adjust: exact;
      color-adjust: exact;
    }

今日算法

数组和字符串

开始忙活了,只写了 2 道题

  • 三数之和
  • 矩阵置零

Gitalking ...

Released under the MIT License.