Skip to content

Commit 274cabd

Browse files
committed
docs(bom): edit URL.createObjectURL
1 parent fdc8683 commit 274cabd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/bom/location.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ function handleFiles(files) {
306306

307307
上面代码中,`URL.createObjectURL`方法用来为上传的文件生成一个 URL 字符串,作为`<img>`元素的图片来源。
308308

309+
该方法生成的 URL 就像下面的样子。
310+
311+
```javascript
312+
blob:http://localhost/c745ef73-ece9-46da-8f66-ebes574789b1
313+
```
314+
309315
注意,每次使用`URL.createObjectURL`方法,都会在内存里面生成一个 URL 实例。如果不再需要该方法生成的 URL 字符串,为了节省内存,可以使用`URL.revokeObjectURL()`方法释放这个实例。
310316

311317
**(2)URL.revokeObjectURL()**

0 commit comments

Comments
 (0)