Angular uses base64-bit format images/ionic uses base64-bit images/vue uses base64-bit images

When writing the WeChat payment QR code, the picture returned is in base64 format.
A lot of them are converted from base64 to jpg on the Internet. They are all saved locally through file and then read. In fact, they can be loaded directly through the img tag.

Example

  使用原生的标签<img> 代替 <image> 标签即可
  例如:
  <img src="data:image/png;base64,xxxxxxxxxxxxxxx">

Of course, not only png images can be loaded, but other formats can be parsed

The following is the sorted out type, where data represents the name of the agreement to obtain the data: the following xxx/xx is the data type name, the subsequent base64 is the data encoding method, and the comma after base64 is the xxx/xxx file base64 encoded The data.
Code format Code type
data:text/css;base64 Base64 encoded CSS code
data:text/javascript Javascript code
data:text/javascript;base64 Base64 encoded Javascript code
data:image/gif;base64 Base64 encoded gif image data
data:image/png;base64 Base64 encoded png image data

Guess you like

Origin blog.csdn.net/qq_25992675/article/details/98115849