博客 / 列表

小盼田 - React 如何區分 Class 和 Function?

當我們要渲染一個組件時,通常並不需要關心它是如何定義(是Class還是Function): function Greeting() { return pHello/p; } class Greeting extends React.Component { render() { return pHello/p; } 使用 // 是類還是函數 —— 無所謂 Greeting /

react , prototype , component , class

小盼田 - canvas 2 image的使用小心得

在開發中遇到一個設置透明色的需求,大概描述就是一張圖,然後再給一個顏色,把這個圖片上所有這個顏色的像素點設置為透明色,如下圖 實現思路就是將圖片畫到canvas上,然後遍歷圖片像素信息,將指定的rgb的alpha設置為0,即設置為全透明。 const canvas = document.createElement('canvas'); const context = canv

base64 , canvas