{"id":19057426,"url":"https://github.com/femessage/upload-to-ali","last_synced_at":"2026-05-12T06:30:18.170Z","repository":{"id":46768611,"uuid":"161151813","full_name":"FEMessage/upload-to-ali","owner":"FEMessage","description":"☁️Upload to ali-oss easily","archived":false,"fork":false,"pushed_at":"2021-09-27T08:22:22.000Z","size":7251,"stargazers_count":20,"open_issues_count":17,"forks_count":16,"subscribers_count":4,"default_branch":"dev","last_synced_at":"2025-02-02T22:26:56.553Z","etag":null,"topics":["dotenv","oss","upload"],"latest_commit_sha":null,"homepage":"https://femessage.github.io/upload-to-ali/","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FEMessage.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-10T09:43:06.000Z","updated_at":"2024-10-02T01:55:25.000Z","dependencies_parsed_at":"2022-09-02T12:11:44.531Z","dependency_job_id":null,"html_url":"https://github.com/FEMessage/upload-to-ali","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupload-to-ali","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupload-to-ali/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupload-to-ali/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupload-to-ali/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FEMessage","download_url":"https://codeload.github.com/FEMessage/upload-to-ali/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240113944,"owners_count":19749829,"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":["dotenv","oss","upload"],"created_at":"2024-11-08T23:57:20.037Z","updated_at":"2026-05-12T06:30:18.138Z","avatar_url":"https://github.com/FEMessage.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# upload-to-ali\n\n[![Build Status](https://badgen.net/travis/FEMessage/upload-to-ali/master)](https://travis-ci.com/FEMessage/upload-to-ali)\n[![NPM Download](https://badgen.net/npm/dm/@femessage/upload-to-ali)](https://www.npmjs.com/package/@femessage/upload-to-ali)\n[![NPM Version](https://badgen.net/npm/v/@femessage/upload-to-ali)](https://www.npmjs.com/package/@femessage/upload-to-ali)\n[![NPM License](https://badgen.net/npm/license/@femessage/upload-to-ali)](https://github.com/FEMessage/upload-to-ali/blob/master/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/upload-to-ali/pulls)\n[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)\n\n可通过环境变量配置上传信息，可自定义域名，支持多选、限制文件大小、删除、粘贴上传功能，拖拽上传功能，让上传功能更加简单。\n\u003e 虽然最初的设计是上传至阿里云，但现在已可通过设置环境变量 `UPLOAD_ACTION` 把数据传送至自定义的后端接口，因此，理论上可以上传至任何云！考虑到有许多项目在用，就暂时不改包名了。\n\n![](https://i.loli.net/2019/11/15/UZ2P7wR83GiDXky.gif)\n\n## Table of Contents\n\n- [Feature](#feature)\n- [Links](#links)\n- [Install](#install)\n- [Config](#config)\n- [Dotenv](#dotenv)\n- [Contributing](#contributing)\n- [Contributors](#contributors)\n- [License](#license)\n\n## Feature\n\n- 只需配置少量上传信息，即可实现上传功能\n- 上传前自动压缩图片，上传过程中有 loading 提示，支持图片显示及删除\n- 可拓展自定义 loading 和默认上传样式\n- 可限制上传文件大小和上传文件数量\n- 可截图粘贴上传\n- 可拖拽上传\n- 可预览图片\n- 支持 v-model\n\n可以只设置 `action` props, 指向上传地址，组件内部默认实现了一套 post 方法，向上传地址传递数据\n\n可以设置 `request`，实现自定义上传函数，覆盖原有默认的上传行为\n\n[⬆ Back to Top](#table-of-contents)\n\n## Links\n\n- [docs](https://FEMessage.github.io/upload-to-ali/)\n- [ali oss guide](docs/guide-ali-oss.md)\n\n[⬆ Back to Top](#table-of-contents)\n\n## Install\n\n```sh\nyarn add @femessage/upload-to-ali\n```\n\n[⬆ Back to Top](#table-of-contents)\n\n## Dotenv\n\n推荐使用环境变量配置上传参数\n\n使用 dotenv，我们只需要将环境变量配置写在`.env`文件中，配合 CI 工具，可满足同一套代码在不同环境对接不同上传配置的需求\n\n以下是所有可传入的环境变量\n\n```sh\n# .env文件\n# 以下所有参数都是可选的\nUPLOAD_ACTION=upload-url\n\nOSS_BUCKET=your-bucket\nOSS_REGION=oss-cn-beijing\nOSS_DIR=oss-dir\nOSS_CUSTOM_DOMAIN=cdn.xxx.com\n```\n\n`dotenv` 文档参考 https://www.npmjs.com/package/dotenv\n\n### vue-cli3\n\nvue-cli3 提供了简便的方案替换[环境变量](https://cli.vuejs.org/zh/guide/mode-and-env.html#%E6%A8%A1%E5%BC%8F)，但无法在客户端注入。这个场景需要结合`dotenv-webpack`插件。\n\n```js\n// vue.config.js\nconst Dotenv = require('dotenv-webpack')\nmodule.exports = {\n  configureWebpack: {\n    plugins: [new Dotenv()]\n  }\n}\n```\n\n[⬆ Back to Top](#table-of-contents)\n\n## Contributing\n\nFor those who are interested in contributing to this project, such as:\n\n- report a bug\n- request new feature\n- fix a bug\n- implement a new feature\n\nPlease refer to our [contributing guide](https://github.com/FEMessage/.github/blob/master/CONTRIBUTING.md).\n\n[⬆ Back to Top](#table-of-contents)\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://levy.work\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/9384365?v=4\" width=\"100px;\" alt=\"levy\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003elevy\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=levy9527\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#review-levy9527\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"#infra-levy9527\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"#blog-levy9527\" title=\"Blogposts\"\u003e📝\u003c/a\u003e \u003ca href=\"#ideas-levy9527\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Alvin-Liu\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/11909145?v=4\" width=\"100px;\" alt=\"Alvin\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlvin\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=Alvin-Liu\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#review-Alvin-Liu\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/listars\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/20613509?v=4\" width=\"100px;\" alt=\"listars\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003elistars\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=listars\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#review-listars\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=listars\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://evila.me\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/19513289?v=4\" width=\"100px;\" alt=\"EVILLT\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eEVILLT\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=evillt\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=evillt\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://donaldshen.github.io/portfolio\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/19591950?v=4\" width=\"100px;\" alt=\"Donald Shen\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDonald Shen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=donaldshen\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=donaldshen\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://67.216.223.155/resume/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/26338853?v=4\" width=\"100px;\" alt=\"OuZuYu\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOuZuYu\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/issues?q=author%3AOuZuYu\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://justcodeit.fun\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/18013127?v=4\" width=\"100px;\" alt=\"轻剑快马\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e轻剑快马\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/commits?author=xrr2016\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://colmugx.github.io\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/21327913?v=4\" width=\"100px;\" alt=\"ColMugX\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eColMugX\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/issues?q=author%3Acolmugx\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://rexer.wang\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/15629940?v=4\" width=\"100px;\" alt=\"Rexer Wang\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRexer Wang\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/upload-to-ali/issues?q=author%3Arexerwang\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## License\n\n[MIT](./LICENSE)\n\n[⬆ Back to Top](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fupload-to-ali","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffemessage%2Fupload-to-ali","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fupload-to-ali/lists"}