{"id":13535795,"url":"https://github.com/waynecz/vue-img-inputer","last_synced_at":"2025-05-16T18:09:52.039Z","repository":{"id":52152244,"uuid":"82367007","full_name":"waynecz/vue-img-inputer","owner":"waynecz","description":"🏞 A graceful image type inputer / uploader","archived":false,"fork":false,"pushed_at":"2019-09-06T05:03:40.000Z","size":5133,"stargazers_count":565,"open_issues_count":8,"forks_count":125,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-12T17:48:31.845Z","etag":null,"topics":["component","input","ui","vue","vue2"],"latest_commit_sha":null,"homepage":"http://waynecz.github.io/VueImgInputer/index.html","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waynecz.png","metadata":{"files":{"readme":"README-CN.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-18T06:33:50.000Z","updated_at":"2024-11-05T09:55:09.000Z","dependencies_parsed_at":"2022-09-02T02:13:09.112Z","dependency_job_id":null,"html_url":"https://github.com/waynecz/vue-img-inputer","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Fvue-img-inputer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Fvue-img-inputer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Fvue-img-inputer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynecz%2Fvue-img-inputer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waynecz","download_url":"https://codeload.github.com/waynecz/vue-img-inputer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254032746,"owners_count":22003007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","input","ui","vue","vue2"],"created_at":"2024-08-01T09:00:27.559Z","updated_at":"2025-05-16T18:09:52.018Z","avatar_url":"https://github.com/waynecz.png","language":"Vue","funding_links":[],"categories":["*.js","UI组件","Awesome Vue.js [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)","Components \u0026 Libraries","UI Components [🔝](#readme)","UI Components"],"sub_categories":["Vue","Libraries \u0026 Plugins","形成","UI Components","Form"],"readme":"\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"300px\" src=\"./src/assets/vip-logo.png\" alt=\"vip\" /\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/badge/release-v2.1.0-orange.svg?style=for-the-badge\"/\u003e\n  \u003cimg alt=\"poi\" src=\"https://img.shields.io/badge/poi-10-green.svg?style=for-the-badge\"/\u003e\n  \u003cimg alt=\"Bili\" src=\"https://img.shields.io/badge/bili-3-blue.svg?style=for-the-badge\"/\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e\n    \u003ca href=\"https://segmentfault.com/a/1190000008503338\"\u003e教程: 从0开始做一个文件选择(上传)组件\u003c/a\u003e\n    |\n    \u003ca href=\"http://waynecz.github.io/VueImgInputer/index.html\"\u003e查看 Demo\u003c/a\u003e\n  \u003c/b\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## 简介\n\n- 就像 `\u003cinput type=\"file\" /\u003e`，不支持多图片选择\n- 支持自动上传功能\n- 拖拽选择、预览、也可以当 `\u003cimg/\u003e` 使用\n- 两套主题，其他高度定制\n\n\u003cbr\u003e\n\n## 截图\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"180px\" src=\"./src/assets/screenshot.gif\"/\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## 使用\n\n```bash\nnpm install vue-img-inputer\n```\n\n```javascript\nimport ImgInputer from 'vue-img-inputer'\nimport 'vue-img-inputer/dist/index.css'\n\nVue.component('ImgInputer', ImgInputer)\n```\n\n```html\n\u003cimg-inputer v-model=\"file\" theme=\"light\" size=\"large\"/\u003e\n```\n\n\u003cbr\u003e\n\n## 接口\n\n\u003cdetails open\u003e\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003e自动上传\u003c/code\u003e 相关\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n1.  **`auto-upload`**: Boolean  \n    设置开启自动上传功能\n\n2.  **`action`**: String  \n    上传的 URL\n\n3.  **`upload-key`**: String  \n    **default**: `file`  \n    图片在 form-data 中的 key 名\n\n4.  **`extra-data`**: Object  \n    上传的额外数据\n\n5.  **`headers`**: Object  \n    上传的额外 headers\n\n6.  **`with-cookie`**: Boolean  \n    是否携带 cookie\n\n7.  **`on-start`**: Function  \n    **params**: func ( file )  \n    上传开始的钩子函数\n\n8.  **`on-progress`**: Function  \n    **params**: func ( event, file )  \n    上传中的钩子函数，可以通过 `event.percent` 获得当前上传进度\n\n9.  **`on-success`**: Function  \n    **params**: func ( res, file )  \n    上传成功的钩子函数，`res` 是服务端返回的数据\n\n10. **`on-error`**: Function  \n    **params**: func ( err, file )  \n    上传失败的钩子函数\n\n\u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003eInput 标签\u003c/code\u003e 相关\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n1.  **`accept`**: String  \n    **default**: `image/*,video/*;`  \n    建议设置成像 `image/jpg,image/gif;` 之类的具体指，不然可能造成文件夹呼出特别慢\n\n2.  **`placeholder`**: String  \n    **default**: `点击或拖拽选择图片`\n\n3.  **`id`**: String  \n    **default**: random string in 4 length\n\n4.  **`readonly`**: Boolean\n\n5.  **`capture`**: Boolean  \n    **default**: `false`  \n    在移动端是否直接呼出相机\n\n6.  **`max-size`**: Number  \n    **default**: 5120  \n    图片大小限制 (KB)\n\n7.  **`name`**: Boolean  \n    原生 name 属性\n\n8.  **`任意 input 的原生属性`**: any  \n    任意 input 的原生属性都将继承给内部的 input 标签\n\n\u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003e视觉 \u003c/code\u003e 相关\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n1.  **`img-src`**: String  \n    图片回填地址，设置后组件将会像 `\u003cimg /\u003e` 标签一样\n\n2.  **`theme`**: String  \n    **default**: `material`\n    两套主题 (light / material)\n\n3.  **`size`**: String\n    small / normal / large\n\n4.  **`icon`**: String  \n    clip / img / img2\n\n5.  **`ali-icon`**: String  \n    如果你用了 [iconfont.cn](http://iconfont.cn/), 可以设置你项目里的 icon unicode 值\n\n6.  **`no-mask`**: Boolean  \n    去除 hover 蒙版\n\n7.  **`no-hover-effect`**: Boolean  \n    去除所有 hover 效果\n\n8.  **`bottom-text`**: String  \n    **default**: `点击或拖拽图片以修改`  \n    hover 后底部的文字\n\n9.  **`readonly-tip-text`**: String  \n    **default**: `不可更改`  \n    只读情况下底部的文字\n\n\u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003e事件\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n1.  **`on-change`**: Function  \n    **params**: func ( file, fileName )  \n    文件更改时的钩子函数\n\n2.  **`onExceed`**: Function  \n    **params**: func ( file )  \n    文件超出最大设置时的钩子函数\n\n\u003cbr/\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003e组件方法\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\n1.  **`reset`**  \n    重置组建的数据，但不重置 `img-src`\n\n\u003cbr/\u003e\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynecz%2Fvue-img-inputer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaynecz%2Fvue-img-inputer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynecz%2Fvue-img-inputer/lists"}