├── LICENSE
├── README.md
├── css
└── tinyImgUpload.css
├── index.html
└── js
└── tinyImgUpload.js
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # tinyImgUpload
2 | 一个灵活的图片上传插件,支持预览和异步上传图片,并且不依赖jQuery等js库。
3 | A flexible and independent image upload plugin that can preview and upload image asynchronously.
4 |
5 | ## 使用方法
6 | 执行tinyImgUpload方法
7 | tinyImgUpload(ele, options)
8 | @param ele [string] [生成组件的元素的选择器]
9 | @param options [Object] [对组件设置的基本参数]
10 | options具体参数如下
11 | * path 图片上传的地址路径 必需
12 | * onSuccess(res) 文件上传成功后的回调 参数为返回的文本 必需
13 | * onFailure(res) 文件上传失败后的回调 参数为返回的文本 必需
14 |
15 | @return [function] [执行图片上传的函数]
16 |
17 | 示例
18 | 用户引入插件代码后,只需要像下面这样,设置一些参数,然后执行一个方法就生成一个图片上传组件。
19 | ```
20 |