Skip to content

Commit beb730e

Browse files
authored
docs(uploader): update (#2265)
1 parent 46db831 commit beb730e

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

src/packages/uploader/doc.en-US.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { Uploader } from '@nutui/nutui-react';
2323
> When using the Uploader component to upload files, you may encounter the problem of garbled Chinese characters in the response file information. This usually happens when the client and server are inconsistent in how they handle the encoding of the file. To avoid this problem, it is recommended to ensure that the encoding format of the file read by the server is consistent with that of the client.
2424
2525
```javascript
26+
import React from 'react'
27+
import { Uploader } from '@nutui/nutui-react'
2628
// Server Demo
2729
app.post('/upload', upload.single('file'), (req, res) => {
2830
const fileEncoding = req.headers['x-file-encoding'] || 'UTF-8';

src/packages/uploader/doc.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ import { Uploader } from '@nutui/nutui-react';
2323
> 在使用Uploader组件上传文件时,可能会遇到响应文件信息中文乱码的问题。这通常发生在客户端与服务器端在处理文件编码时不一致的情况下。为了避免这种问题,建议确保服务器端读取文件的编码格式与客户端保持一致。
2424
2525
```javascript
26+
import React from 'react'
27+
import { Uploader } from '@nutui/nutui-react'
2628
// Server Demo
2729
app.post('/upload', upload.single('file'), (req, res) => {
2830
const fileEncoding = req.headers['x-file-encoding'] || 'UTF-8';
2931
const fileContent = iconv.decode(Buffer.from(JSON.stringify(req.file), 'binary'), fileEncoding);
3032
res.json({ success: true, message: 'File uploaded successfully', data: JSON.parse(fileContent) });
3133
});
34+
3235
// Client Demo
3336
<Uploader url={uploadUrl} headers={{'x-file-encoding': 'UTF-8'}} />
34-
3537
```
3638

3739
### 基础用法

src/packages/uploader/doc.taro.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { Uploader } from '@nutui/nutui-react-taro';
2323
> 在使用Uploader组件上传文件时,可能会遇到响应文件信息中文乱码的问题。这通常发生在客户端与服务器端在处理文件编码时不一致的情况下。为了避免这种问题,建议确保服务器端读取文件的编码格式与客户端保持一致。
2424
2525
```javascript
26+
import React from 'react'
27+
import { Uploader } from '@nutui/nutui-react'
2628
// Server Demo
2729
app.post('/upload', upload.single('file'), (req, res) => {
2830
const fileEncoding = req.headers['x-file-encoding'] || 'UTF-8';

src/packages/uploader/doc.zh-TW.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { Uploader } from '@nutui/nutui-react';
2323
> 在使用Uploader組件上傳文件時,可能會遇到響應文件信息中文亂碼的問題。這通常發生在客戶端與服務器端在處理文件編碼時不一致的情況下。為了避免這種問題,建議確保服務器端讀取文件的編碼格式與客戶端保持一致。
2424
2525
```javascript
26+
import React from 'react'
27+
import { Uploader } from '@nutui/nutui-react'
2628
// Server Demo
2729
app.post('/upload', upload.single('file'), (req, res) => {
2830
const fileEncoding = req.headers['x-file-encoding'] || 'UTF-8';

0 commit comments

Comments
 (0)