ソースを参照

chore(uploader): use icons-vue component

richard1015 3 年 前
コミット
8a404f984c

+ 38 - 32
src/packages/__VUE/uploader/doc.en-US.md

@@ -8,12 +8,10 @@ Used to upload local pictures or files to the server.
 
 ``` javascript
 import { createApp } from 'vue';
-import { Uploader,Icon,Progress } from '@nutui/nutui';
+import { Uploader } from '@nutui/nutui';
 
 const app = createApp();
 app.use(Uploader);
-app.use(Icon);
-app.use(Progress);
 
 ```
 
@@ -363,34 +361,34 @@ export default {
 ## API
 ### Props
 
-| Attribute         | Description                                                                                                                                      | Type                              | Default          |
-|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|------------------|
-| auto-upload       | Whether to upload the file immediately after selecting it, if false, you need to manually execute the ref submit method to upload                | Boolean                           | true             |
-| name              | The name of the `input` tag `name`, the file parameter name sent to the background                                                               | String                            | "file"           |
-| url               | The interface address of the upload server                                                                                                       | String                            | -                |
-| v-model:file-list | List of uploaded files by default                                                                                                                | FileItem[]                        | []               |
-| is-preview        | Whether to display the preview image after the upload is successful                                                                              | Boolean                           | true             |
-| is-deletable      | Whether to display the delete button                                                                                                             | Boolean                           | true             |
-| method            | The http method of upload request                                                                                                                | String                            | "post"           |
-| list-type         | Built-in stylesheets, support for three types: `picture`、`list`                                                                                 | String                            | "picture"        |
-| capture           | Capture, can be set to [camera](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#htmlattrdefcapture),turn on the camera directly | String                            | false            |
-| maximize          | You can set the maximum upload file size (bytes)                                                                                                 | Number丨String                    | Number.MAX_VALUE |
-| maximum           | File upload limit                                                                                                                                | Number丨String                    | 1                |
-| clear-input       | Whether to clear the `input` content, set to `true` to support repeated selection and upload of the same file                                    | Boolean                           | true             |
-| accept            | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept)       | String                            | *                |
-| headers           | Set request headers                                                                                                                              | Object                            | {}               |
-| data              | Uploading extra params or function which can return uploading extra params                                                                       | Object                            | {}               |
-| upload-icon       | Upload area [icon name](#/en-US/component/icon) or image link                                                                                                    | String                            | "photograph"     |
-| upload-icon-size  | Upload area [icon size] (#/en-US/component/icon) size, such as `20px` `2em` `2rem`                                                                               | String or Number                  | -                |
-| xhr-state         | The success status (status) value of the interface response                                                                                      | Number                            | 200              |
-| with-credentials  | The ajax upload with cookie sent                                                                                                                 | Boolean                           | false            |
-| multiple          | Whether to support multiple file selection                                                                                                       | Boolean                           | false            |
-| disabled          | Whether to disable file upload                                                                                                                   | Boolean                           | false            |
-| timeout           | timeout, in milliseconds                                                                                                                         | Number丨String                    | 1000 * 30        |
-| before-upload     | Hook before reading the file, return false to stop reading the file, can return Promise                                                          | Function                          | null             |
-| before-xhr-upload`v3.2.1` | Customize the method when uploading XHR                                                                                                                                                                          | Function(xhr,option)                          | null             |
-| before-delete     | Hook before delete the file, return false to stop reading the file, can return Promise                                                           | Function(file,fileList): boolean 丨Promise | -                |
-| delete-icon               | Customize the delete button by passing in [icon name](/#/en-US/component/icon) or an image link                                                                                                                                                   | String                            | "photograph"     |
+| Attribute                 | Description                                                                                                                                      | Type                                       | Default          |
+|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|------------------|
+| auto-upload               | Whether to upload the file immediately after selecting it, if false, you need to manually execute the ref submit method to upload                | Boolean                                    | true             |
+| name                      | The name of the `input` tag `name`, the file parameter name sent to the background                                                               | String                                     | "file"           |
+| url                       | The interface address of the upload server                                                                                                       | String                                     | -                |
+| v-model:file-list         | List of uploaded files by default                                                                                                                | FileItem[]                                 | []               |
+| is-preview                | Whether to display the preview image after the upload is successful                                                                              | Boolean                                    | true             |
+| is-deletable              | Whether to display the delete button                                                                                                             | Boolean                                    | true             |
+| method                    | The http method of upload request                                                                                                                | String                                     | "post"           |
+| list-type                 | Built-in stylesheets, support for three types: `picture`、`list`                                                                                 | String                                     | "picture"        |
+| capture                   | Capture, can be set to [camera](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#htmlattrdefcapture),turn on the camera directly | String                                     | false            |
+| maximize                  | You can set the maximum upload file size (bytes)                                                                                                 | Number丨String                             | Number.MAX_VALUE |
+| maximum                   | File upload limit                                                                                                                                | Number丨String                             | 1                |
+| clear-input               | Whether to clear the `input` content, set to `true` to support repeated selection and upload of the same file                                    | Boolean                                    | true             |
+| accept                    | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept)       | String                                     | *                |
+| headers                   | Set request headers                                                                                                                              | Object                                     | {}               |
+| data                      | Uploading extra params or function which can return uploading extra params                                                                       | Object                                     | {}               |
+| upload-icon               | Upload area [icon name](#/en-US/component/icon) or image link                                                                                    | String                                     | "photograph"     |
+| upload-icon-size          | Upload area [icon size] (#/en-US/component/icon) size, such as `20px` `2em` `2rem`                                                               | String or Number                           | -                |
+| xhr-state                 | The success status (status) value of the interface response                                                                                      | Number                                     | 200              |
+| with-credentials          | The ajax upload with cookie sent                                                                                                                 | Boolean                                    | false            |
+| multiple                  | Whether to support multiple file selection                                                                                                       | Boolean                                    | false            |
+| disabled                  | Whether to disable file upload                                                                                                                   | Boolean                                    | false            |
+| timeout                   | timeout, in milliseconds                                                                                                                         | Number丨String                             | 1000 * 30        |
+| before-upload             | Hook before reading the file, return false to stop reading the file, can return Promise                                                          | Function                                   | null             |
+| before-xhr-upload`v3.2.1` | Customize the method when uploading XHR                                                                                                          | Function(xhr,option)                      | null             |
+| before-delete             | Hook before delete the file, return false to stop reading the file, can return Promise                                                           | Function(file,fileList): boolean 丨Promise | -                |
+| delete-icon               | Customize the delete button by passing in [icon name](/#/en-US/component/icon) or an image link                                                  | String                                     | "photograph"     |
 
 
 ### FileItem
@@ -417,6 +415,14 @@ export default {
 | delete          | File delete event                                        | {files,fileList,index}         |
 | file-item-click | Click to trigger after the file is uploaded successfully | {fileItem}                     |
 
+### Uploader Slots
+
+| Name               | Description                          |
+|--------------------|--------------------------------------|
+| default            | Default slot                         |
+| upload-icon`4.0.0` | Custom Uploader Button Center `icon` |
+| delete-icon`4.0.0` | Custom Right Delete Button           |
+
 ### Methods
 
 Use [ref](https://vuejs.org/guide/essentials/template-refs.html#template-refs) to get Uploader instance and call instance methods.
@@ -424,4 +430,4 @@ Use [ref](https://vuejs.org/guide/essentials/template-refs.html#template-refs) t
 | Name             | Description                                                                                 | Arguments | Return value |
 |------------------|---------------------------------------------------------------------------------------------|-----------|--------------|
 | submit           | Manual upload mode, perform upload operation                                                | -         | -            |
-| clearUploadQueue | Empty the selected file queue (this method is generally used when uploading in manual mode) | index         | -            |
+| clearUploadQueue | Empty the selected file queue (this method is generally used when uploading in manual mode) | index     | -            |

+ 35 - 30
src/packages/__VUE/uploader/doc.md

@@ -8,12 +8,10 @@
 
 ``` javascript
 import { createApp } from 'vue';
-import { Uploader,Icon,Progress } from '@nutui/nutui';
+import { Uploader } from '@nutui/nutui';
 
 const app = createApp();
 app.use(Uploader);
-app.use(Icon);
-app.use(Progress);
 
 ```
 
@@ -363,34 +361,32 @@ export default {
 ## API
 ### Props
 
-| 字段                      | 说明                                                                                                                                                                                   | 类型                              | 默认值           |
-|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|------------------|
-| auto-upload               | 是否在选取文件后立即进行上传,false 时需要手动执行 ref submit 方法进行上传                                                                                                             | Boolean                           | true             |
-| name                      | `input` 标签 `name` 的名称,发到后台的文件参数名                                                                                                                                       | String                            | "file"           |
-| url                       | 上传服务器的接口地址                                                                                                                                                                   | String                            | -                |
-| v-model:file-list         | 默认已经上传的文件列表                                                                                                                                                                 | FileItem[]                        | []               |
-| is-preview                | 是否上传成功后展示预览图                                                                                                                                                               | Boolean                           | true             |
-| is-deletable              | 是否展示删除按钮                                                                                                                                                                       | Boolean                           | true             |
-| method                    | 上传请求的 http method                                                                                                                                                                 | String                            | "post"           |
-| list-type                 | 上传列表的内建样式,支持两种基本样式 picture、list                                                                                                                                     | String                            | "picture"        |
-| capture                   | 图片[选取模式](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#htmlattrdefcapture),直接调起摄像头                                                                     | String                            | false            |
-| maximize                  | 可以设定最大上传文件的大小(字节)                                                                                                                                                     | Number丨String                    | Number.MAX_VALUE |
-| maximum                   | 文件上传数量限制                                                                                                                                                                       | Number丨String                    | 1                |
-| clear-input               | 是否需要清空`input`内容,设为`true`支持重复选择上传同一个文件                                                                                                                          | Boolean                           | true             |
-| accept                    | 允许上传的文件类型,[详细说明](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B) | String                            | *                |
-| headers                   | 设置上传的请求头部                                                                                                                                                                     | Object                            | {}               |
-| data                      | 附加上传的信息 formData                                                                                                                                                                | Object                            | {}               |
-| upload-icon               | 上传区域[图标名称](#/zh-CN/component/icon)或图片链接                                                                                                                                                   | String                            | "photograph"     |
-| upload-icon-size          | 上传区域[图标尺寸](#/zh-CN/component/icon)大小,如 `20px` `2em` `2rem`                                                                                                                                 | String or Number                  | -                |
-| xhr-state                 | 接口响应的成功状态(status)值                                                                                                                                                         | Number                            | 200              |
-| with-credentials          | 支持发送 cookie 凭证信息                                                                                                                                                               | Boolean                           | false            |
-| multiple                  | 是否支持文件多选                                                                                                                                                                       | Boolean                           | false            |
-| disabled                  | 是否禁用文件上传                                                                                                                                                                       | Boolean                           | false            |
-| timeout                   | 超时时间,单位为毫秒                                                                                                                                                                   | Number丨String                    | 1000 * 30        |
-| before-upload             | 上传前的函数需要返回一个`Promise`对象                                                                                                                                                  | Function                          | null             |
-| before-xhr-upload`v3.2.1` | 执行 XHR 上传时,自定义方式                                                                                                                                                            | Function(xhr,option)             | null             |
+| 字段                      | 说明                                                                                                                                                                                   | 类型                                       | 默认值           |
+|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|------------------|
+| auto-upload               | 是否在选取文件后立即进行上传,false 时需要手动执行 ref submit 方法进行上传                                                                                                             | Boolean                                    | true             |
+| name                      | `input` 标签 `name` 的名称,发到后台的文件参数名                                                                                                                                       | String                                     | "file"           |
+| url                       | 上传服务器的接口地址                                                                                                                                                                   | String                                     | -                |
+| v-model:file-list         | 默认已经上传的文件列表                                                                                                                                                                 | FileItem[]                                 | []               |
+| is-preview                | 是否上传成功后展示预览图                                                                                                                                                               | Boolean                                    | true             |
+| is-deletable              | 是否展示删除按钮                                                                                                                                                                       | Boolean                                    | true             |
+| method                    | 上传请求的 http method                                                                                                                                                                 | String                                     | "post"           |
+| list-type                 | 上传列表的内建样式,支持两种基本样式 picture、list                                                                                                                                     | String                                     | "picture"        |
+| capture                   | 图片[选取模式](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#htmlattrdefcapture),直接调起摄像头                                                                     | String                                     | false            |
+| maximize                  | 可以设定最大上传文件的大小(字节)                                                                                                                                                     | Number丨String                             | Number.MAX_VALUE |
+| maximum                   | 文件上传数量限制                                                                                                                                                                       | Number丨String                             | 1                |
+| clear-input               | 是否需要清空`input`内容,设为`true`支持重复选择上传同一个文件                                                                                                                          | Boolean                                    | true             |
+| accept                    | 允许上传的文件类型,[详细说明](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B) | String                                     | *                |
+| headers                   | 设置上传的请求头部                                                                                                                                                                     | Object                                     | {}               |
+| data                      | 附加上传的信息 formData                                                                                                                                                                | Object                                     | {}               |
+| upload-icon               | 上传区域[图标名称](#/zh-CN/component/icon)或图片链接                                                                                                                                   | String                                     | "photograph"     |
+| xhr-state                 | 接口响应的成功状态(status)值                                                                                                                                                         | Number                                     | 200              |
+| with-credentials          | 支持发送 cookie 凭证信息                                                                                                                                                               | Boolean                                    | false            |
+| multiple                  | 是否支持文件多选                                                                                                                                                                       | Boolean                                    | false            |
+| disabled                  | 是否禁用文件上传                                                                                                                                                                       | Boolean                                    | false            |
+| timeout                   | 超时时间,单位为毫秒                                                                                                                                                                   | Number丨String                             | 1000 * 30        |
+| before-upload             | 上传前的函数需要返回一个`Promise`对象                                                                                                                                                  | Function                                   | null             |
+| before-xhr-upload`v3.2.1` | 执行 XHR 上传时,自定义方式                                                                                                                                                            | Function(xhr,option)                      | null             |
 | before-delete             | 除文件时的回调,返回值为 false 时不移除。支持返回一个 `Promise` 对象,`Promise` 对象 resolve(false) 或 reject 时不移除                                                                 | Function(file,fileList): boolean 丨Promise | -                |
-| delete-icon               | 自定义删除按钮,可传入[图标名称](/#/zh-CN/component/icon)或图片链接                                                                                                                                                   | String                            | "photograph"     |
 
 > 注意:accept、capture 和 multiple 为浏览器 input 标签的原生属性,移动端各种机型对这些属性的支持程度有所差异,因此在不同机型和 WebView 下可能出现一些兼容性问题。
 
@@ -418,6 +414,15 @@ export default {
 | delete          | 文件删除事件           | {files,fileList,index}         |
 | file-item-click | 文件上传成功后点击触发 | {fileItem}                     |
 
+### Uploader Slots
+
+| 名称               | 说明                         |
+|--------------------|------------------------------|
+| default            | 默认插槽自定义内容           |
+| upload-icon`4.0.0` | 自定义上传按钮中间`icon`区域 |
+| delete-icon`4.0.0` | 自定义右上角删除按钮区域     |
+
+
 ### Methods
 
 通过 [ref](https://vuejs.org/guide/essentials/template-refs.html#template-refs) 可以获取到 Uploader 实例并调用实例方法

+ 32 - 28
src/packages/__VUE/uploader/doc.taro.md

@@ -8,12 +8,10 @@
 
 ``` javascript
 import { createApp } from 'vue';
-import { Uploader,Icon,Progress } from '@nutui/nutui-taro';
+import { Uploader } from '@nutui/nutui-taro';
 
 const app = createApp();
 app.use(Uploader);
-app.use(Icon);
-app.use(Progress);
 
 ```
 
@@ -230,32 +228,29 @@ setup() {
 ## API
 ### Props
 
-| 字段                      | 说明                                                                                                                   | 类型                              | 默认值                    |
-|---------------------------|------------------------------------------------------------------------------------------------------------------------|-----------------------------------|---------------------------|
-| auto-upload               | 是否在选取文件后立即进行上传,false 时需要手动执行 ref submit 方法进行上传                                             | Boolean                           | true                      |
-| name                      | 发到后台的文件参数名                                                                                                   | String                            | "file"                    |
-| url                       | 上传服务器的接口地址                                                                                                   | String                            | -                         |
-| v-model:file-list         | 默认已经上传的文件列表                                                                                                 | FileItem[]                        | []                        |
-| is-preview                | 是否上传成功后展示预览图                                                                                               | Boolean                           | true                      |
-| is-deletable              | 是否展示删除按钮                                                                                                       | Boolean                           | true                      |
-| method                    | 上传请求的 http method                                                                                                 | String                            | "post"                    |
-| list-type                 | 上传列表的内建样式,支持两种基本样式 picture、list                                                                     | String                            | "picture"                 |
-| source-type               | [选择图片的来源](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)                 | String                            | ['album','camera']        |
-| maximize                  | 可以设定最大上传文件的大小(字节)                                                                                     | Number丨String                    | 9                         |
-| maximum                   | 文件上传数量限制                                                                                                       | Number丨String                    | 1                         |
-| size-type                 | 是否压缩所选文件[详细说明](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)       | String                            | ['original','compressed'] |
-| headers                   | 设置上传的请求头部                                                                                                     | Object                            | {}                        |
-| data                      | 附加上传的信息 formData                                                                                                | Object                            | {}                        |
-| upload-icon               | 上传区域[图标名称](#/zh-CN/component/icon)或图片链接                                                                                   | String                            | "photograph"              |
-| upload-icon-size          | 上传区域[图标尺寸](#/zh-CN/component/icon)大小,如 `20px` `2em` `2rem`                                                                 | String or Number                  | -                         |
-| xhr-state                 | 接口响应的成功状态(status)值                                                                                         | Number                            | 200                       |
-| disabled                  | 是否禁用文件上传                                                                                                       | Boolean                           | false                     |
-| multiple`v2.3.4`                  | 是否支持文件多选                                                                                                       | Boolean                           | true            |
-| timeout                   | 超时时间,单位为毫秒                                                                                                   | Number丨String                    | 1000 * 30                 |
-| before-upload             | 上传前的函数需要返回一个`Promise`对象                                                                                  | Function                          | null                      |
-| before-xhr-upload`v3.2.1` | 执行 Taro.uploadFile 上传时,自定义方式                                                                                | Function(Taro.uploadFile,option) | null                      |
+| 字段                      | 说明                                                                                                                   | 类型                                       | 默认值                    |
+|---------------------------|------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|---------------------------|
+| auto-upload               | 是否在选取文件后立即进行上传,false 时需要手动执行 ref submit 方法进行上传                                             | Boolean                                    | true                      |
+| name                      | 发到后台的文件参数名                                                                                                   | String                                     | "file"                    |
+| url                       | 上传服务器的接口地址                                                                                                   | String                                     | -                         |
+| v-model:file-list         | 默认已经上传的文件列表                                                                                                 | FileItem[]                                 | []                        |
+| is-preview                | 是否上传成功后展示预览图                                                                                               | Boolean                                    | true                      |
+| is-deletable              | 是否展示删除按钮                                                                                                       | Boolean                                    | true                      |
+| method                    | 上传请求的 http method                                                                                                 | String                                     | "post"                    |
+| list-type                 | 上传列表的内建样式,支持两种基本样式 picture、list                                                                     | String                                     | "picture"                 |
+| source-type               | [选择图片的来源](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)                 | String                                     | ['album','camera']        |
+| maximize                  | 可以设定最大上传文件的大小(字节)                                                                                     | Number丨String                             | 9                         |
+| maximum                   | 文件上传数量限制                                                                                                       | Number丨String                             | 1                         |
+| size-type                 | 是否压缩所选文件[详细说明](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)       | String                                     | ['original','compressed'] |
+| headers                   | 设置上传的请求头部                                                                                                     | Object                                     | {}                        |
+| data                      | 附加上传的信息 formData                                                                                                | Object                                     | {}                        |
+| xhr-state                 | 接口响应的成功状态(status)值                                                                                         | Number                                     | 200                       |
+| disabled                  | 是否禁用文件上传                                                                                                       | Boolean                                    | false                     |
+| multiple`v2.3.4`          | 是否支持文件多选                                                                                                       | Boolean                                    | true                      |
+| timeout                   | 超时时间,单位为毫秒                                                                                                   | Number丨String                             | 1000 * 30                 |
+| before-upload             | 上传前的函数需要返回一个`Promise`对象                                                                                  | Function                                   | null                      |
+| before-xhr-upload`v3.2.1` | 执行 Taro.uploadFile 上传时,自定义方式                                                                                | Function(Taro.uploadFile,option)          | null                      |
 | before-delete             | 除文件时的回调,返回值为 false 时不移除。支持返回一个 `Promise` 对象,`Promise` 对象 resolve(false) 或 reject 时不移除 | Function(file,fileList): boolean 丨Promise | -                         |
-| delete-icon               | 自定义删除按钮,可传入[图标名称](/#/zh-CN/component/icon)或图片链接                                                                                                                                                   | String                            | "photograph"     |
 
 
 ### FileItem
@@ -281,6 +276,15 @@ setup() {
 | delete          | 文件删除事件           | {files,fileList,index}    |
 | file-item-click | 文件上传成功后点击触发 | {fileItem}                |
 
+### Uploader Slots
+
+| 名称               | 说明                         |
+|--------------------|------------------------------|
+| default            | 默认插槽自定义内容           |
+| upload-icon`4.0.0` | 自定义上传按钮中间`icon`区域 |
+| delete-icon`4.0.0` | 自定义右上角删除按钮区域     |
+
+
 
 ### Methods
 

+ 2 - 0
src/packages/__VUE/uploader/index.scss

@@ -85,6 +85,8 @@
         -webkit-line-clamp: 1;
         padding: 2px;
         height: 24px;
+        display: flex;
+        align-items: center;
       }
 
       .nut-uploader__preview-img__file__del {

+ 19 - 26
src/packages/__VUE/uploader/index.taro.vue

@@ -10,21 +10,17 @@
     <view class="nut-uploader__preview" :class="[listType]" v-for="(item, index) in fileList" :key="item.uid">
       <view class="nut-uploader__preview-img" v-if="listType == 'picture' && !$slots.default">
         <view class="nut-uploader__preview__progress" v-if="item.status != 'success'">
-          <nut-icon
-            color="#fff"
-            :name="item.status == 'error' ? 'failure' : 'loading'"
-            v-if="item.status != 'ready'"
-          ></nut-icon>
+          <template v-if="item.status != 'ready'">
+            <Failure color="#fff" v-if="item.status == 'error'" />
+            <Loading name="loading" color="#fff" v-else />
+          </template>
           <view class="nut-uploader__preview__progress__msg">{{ item.message }}</view>
         </view>
 
-        <nut-icon
-          v-if="isDeletable"
-          v-bind="$attrs"
-          @click="onDelete(item, index)"
-          class="close"
-          :name="deleteIcon"
-        ></nut-icon>
+        <view class="close" v-if="isDeletable" @click="onDelete(item, index)">
+          <slot name="delete-icon"> <Failure /></slot>
+        </view>
+
         <img
           class="nut-uploader__preview-img__c"
           @click="fileItemClick(item)"
@@ -33,21 +29,17 @@
         />
         <view v-else class="nut-uploader__preview-img__file">
           <view class="nut-uploader__preview-img__file__name" @click="fileItemClick(item)">
-            <nut-icon color="#808080" name="link"></nut-icon>&nbsp;{{ item.name }}
+            <Link color="#808080" />&nbsp;{{ item.name }}
           </view>
         </view>
         <view class="tips">{{ item.name }}</view>
       </view>
       <view class="nut-uploader__preview-list" v-else-if="listType == 'list'">
         <view class="nut-uploader__preview-img__file__name" @click="fileItemClick(item)" :class="[item.status]">
-          <nut-icon name="link" />&nbsp;{{ item.name }}
+          <Link />&nbsp;{{ item.name }}
         </view>
-        <nut-icon
-          class="nut-uploader__preview-img__file__del"
-          @click="onDelete(item, index)"
-          color="#808080"
-          name="del"
-        />
+        <Del color="#808080" class="nut-uploader__preview-img__file__del" @click="onDelete(item, index)"></Del>
+
         <nut-progress
           size="small"
           :percentage="item.percentage"
@@ -72,7 +64,7 @@
 </template>
 
 <script lang="ts">
-import { computed, onMounted, PropType, reactive } from 'vue';
+import { computed, PropType, reactive } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { UploaderTaro, UploadOptions } from './uploader';
 import { FileItem } from './type';
@@ -82,12 +74,16 @@ import Button from '../button/index.taro.vue';
 const { componentName, create, translate } = createComponent('uploader');
 import Taro from '@tarojs/taro';
 import { isPromise } from '@/packages/utils/util';
-import { Photograph } from '@nutui/icons-vue-taro';
+import { Photograph, Failure, Loading, Del, Link } from '@nutui/icons-vue-taro';
 export default create({
   components: {
     [Progress.name]: Progress,
     [Button.name]: Button,
-    Photograph
+    Photograph,
+    Failure,
+    Loading,
+    Del,
+    Link
   },
   props: {
     name: { type: String, default: 'file' },
@@ -115,13 +111,10 @@ export default create({
     accept: { type: String, default: '*' },
     headers: { type: Object, default: {} },
     data: { type: Object, default: {} },
-    uploadIcon: { type: String, default: 'photograph' },
-    // uploadIconSize: { type: [String, Number], default: '' },
     xhrState: { type: [Number, String], default: 200 },
     multiple: { type: Boolean, default: true },
     disabled: { type: Boolean, default: false },
     autoUpload: { type: Boolean, default: true },
-    deleteIcon: { type: String, default: 'failure' },
     beforeUpload: {
       type: Function,
       default: null

+ 18 - 25
src/packages/__VUE/uploader/index.vue

@@ -8,21 +8,17 @@
     <view class="nut-uploader__preview" :class="[listType]" v-for="(item, index) in fileList" :key="item.uid">
       <view class="nut-uploader__preview-img" v-if="listType == 'picture' && !$slots.default">
         <view class="nut-uploader__preview__progress" v-if="item.status != 'success'">
-          <nut-icon
-            color="#fff"
-            :name="item.status == 'error' ? 'failure' : 'loading'"
-            v-if="item.status != 'ready'"
-          ></nut-icon>
+          <template v-if="item.status != 'ready'">
+            <Failure color="#fff" v-if="item.status == 'error'" />
+            <Loading name="loading" color="#fff" v-else />
+          </template>
           <view class="nut-uploader__preview__progress__msg">{{ item.message }}</view>
         </view>
 
-        <nut-icon
-          v-if="isDeletable"
-          v-bind="$attrs"
-          @click="onDelete(item, index)"
-          class="close"
-          :name="deleteIcon"
-        ></nut-icon>
+        <view class="close" v-if="isDeletable" @click="onDelete(item, index)">
+          <slot name="delete-icon"> <Failure /></slot>
+        </view>
+
         <img
           class="nut-uploader__preview-img__c"
           @click="fileItemClick(item)"
@@ -31,7 +27,7 @@
         />
         <view v-else class="nut-uploader__preview-img__file">
           <view @click="fileItemClick(item)" class="nut-uploader__preview-img__file__name">
-            <nut-icon color="#808080" name="link"></nut-icon>&nbsp;{{ item.name }}
+            <Link color="#808080" />&nbsp;{{ item.name }}
           </view>
         </view>
 
@@ -40,14 +36,10 @@
 
       <view class="nut-uploader__preview-list" v-else-if="listType == 'list'">
         <view @click="fileItemClick(item)" class="nut-uploader__preview-img__file__name" :class="[item.status]">
-          <nut-icon name="link" />&nbsp;{{ item.name }}
+          <Link />&nbsp;{{ item.name }}
         </view>
-        <nut-icon
-          class="nut-uploader__preview-img__file__del"
-          @click="onDelete(item, index)"
-          color="#808080"
-          name="del"
-        />
+        <Del color="#808080" class="nut-uploader__preview-img__file__del" @click="onDelete(item, index)"></Del>
+
         <nut-progress
           size="small"
           :percentage="item.percentage"
@@ -79,12 +71,16 @@ import { Uploader, UploadOptions } from './uploader';
 import { FileItem } from './type';
 import { funInterceptor, Interceptor } from '@/packages/utils/util';
 import Progress from '../progress/index.vue';
-import { Photograph } from '@nutui/icons-vue';
+import { Photograph, Failure, Loading, Del, Link } from '@nutui/icons-vue';
 const { componentName, create, translate } = createComponent('uploader');
 export default create({
   components: {
     [Progress.name]: Progress,
-    Photograph
+    Photograph,
+    Failure,
+    Loading,
+    Del,
+    Link
   },
   props: {
     name: { type: String, default: 'file' },
@@ -104,14 +100,11 @@ export default create({
     accept: { type: String, default: '*' },
     headers: { type: Object, default: {} },
     data: { type: Object, default: {} },
-    uploadIcon: { type: String, default: 'photograph' },
-    uploadIconSize: { type: [String, Number], default: '' },
     xhrState: { type: [Number, String], default: 200 },
     withCredentials: { type: Boolean, default: false },
     multiple: { type: Boolean, default: false },
     disabled: { type: Boolean, default: false },
     autoUpload: { type: Boolean, default: true },
-    deleteIcon: { type: String, default: 'failure' },
     beforeUpload: {
       type: Function,
       default: null